RFC: block/loop.c & crypto

Herbert Valerio Riedel (hvr@hvrlab.org)
Sun, 22 Jul 2001 12:21:30 +0200 (CEST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--856294657-1535242835-995797290=:15777
Content-Type: TEXT/PLAIN; charset=US-ASCII

hello!

...some time has passed since I've contacted you last time about
crypto/loop issues... but now it's time again to annoy you :-)

btw; while I'm at it, a question which came to mind while writing this
mail; is it safe to call...

if (current->need_resched) schedule();

...from within the transfer function? are there possible race conditions
where another transfer request may come in for the same blocks, while
another one is still in progress?

some months ago, when I proposed to switch IV calculation completely to
fixed a fixed 512 byte blocksize, I was reminded, that the international
crypto patch was not the only one to make use of the IV calculatiion, and
doing so would break other crypto packages around...

...so I suggested that I'd try a more backward compatible approach, which
would allow old packages to retain compatibility, and new packages aware
of the new flag to set IV calculation to 512 byte blocks...
well the result of this experiment can be seen in the attachment...

so... any comments?

ps: this are the only changes to kernel sources optionally (!) 'required',
in order to use the international crypto api
(see http://cryptoapi.sourceforge.net/ and the package README file
accessible through CVS for more information)

regards,

-- 
Herbert Valerio Riedel       /    Phone: (EUROPE) +43-1-58801-18840
Email: hvr@gnu.org          /    Finger hvr@gnu.org for GnuPG Public Key
GnuPG Key Fingerprint: 7BB9 2D6C D485 CE64 4748  5F65 4981 E064 883F 4142

--856294657-1535242835-995797290=:15777 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="loop-iv-2.4.6.patch" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.LNX.4.33.0107221221300.15777@janus.txd.hvrlab.org> Content-Description: Content-Disposition: attachment; filename="loop-iv-2.4.6.patch"

ZGlmZiAtdXJOIGxpbnV4LTIuNC42L2RyaXZlcnMvYmxvY2svbG9vcC5jIGxp bnV4LWludC0yLjQuNi9kcml2ZXJzL2Jsb2NrL2xvb3AuYw0KLS0tIGxpbnV4 LTIuNC42L2RyaXZlcnMvYmxvY2svbG9vcC5jCVNhdCBKdW4gMzAgMDE6MTY6 NTYgMjAwMQ0KKysrIGxpbnV4LWludC0yLjQuNi9kcml2ZXJzL2Jsb2NrL2xv b3AuYwlTYXQgSnVsICA3IDEwOjUyOjQxIDIwMDENCkBAIC0zNiw2ICszNiw5 IEBADQogICogQWwgVmlybyB0b28uDQogICogSmVucyBBeGJvZSA8YXhib2VA c3VzZS5kZT4sIE5vdiAyMDAwDQogICoNCisgKiBGaXhlZCBhbmQgbWFkZSBJ ViBjYWxjdWxhdGlvbiBjdXN0b21pemFibGUgYnkgbG9faXZfbW9kZQ0KKyAq IEhlcmJlcnQgVmFsZXJpbyBSaWVkZWwgPGh2ckBnbnUub3JnPiwgQXByIDIw MDENCisgKg0KICAqIFN0aWxsIFRvIEZpeDoNCiAgKiAtIEFkdmlzb3J5IGxv Y2tpbmcgaXMgaWdub3JlZCBoZXJlLiANCiAgKiAtIFNob3VsZCB1c2UgYW4g b3duIENBUF8qIGNhdGVnb3J5IGluc3RlYWQgb2YgQ0FQX1NZU19BRE1JTiAN CkBAIC0xNjQsNiArMTY3LDQzIEBADQogCQkJCQlsby0+bG9fZGV2aWNlKTsN CiB9DQogDQorc3RhdGljIGlubGluZSBpbnQgbG9vcF9nZXRfYnMoc3RydWN0 IGxvb3BfZGV2aWNlICpsbykNCit7DQorCWludCBicyA9IDA7DQorDQorCWlm IChibGtzaXplX3NpemVbTUFKT1IobG8tPmxvX2RldmljZSldKQ0KKwkJYnMg PSBibGtzaXplX3NpemVbTUFKT1IobG8tPmxvX2RldmljZSldW01JTk9SKGxv LT5sb19kZXZpY2UpXTsNCisJaWYgKCFicykNCisJCWJzID0gQkxPQ0tfU0la RTsJDQorDQorCXJldHVybiBiczsNCit9DQorDQorc3RhdGljIGlubGluZSB1 bnNpZ25lZCBsb25nIGxvb3BfZ2V0X2l2KHN0cnVjdCBsb29wX2RldmljZSAq bG8sDQorCQkJCQl1bnNpZ25lZCBsb25nIHNlY3RvcikNCit7DQorCXVuc2ln bmVkIG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qLw0KKyNk ZWZpbmUgTE9fSVZfTU9ERV9TRUNUT1IgIDEgLyogY2FsY3VsYXRlIElWIGJh c2VkIG9uIHJlbGF0aXZlIA0KKwkJCQk1MTIgYnl0ZSBzZWN0b3JzICovDQor I2RlZmluZSBMT19JVl9TRUNUT1JfQklUUyA5DQorI2RlZmluZSBMT19JVl9T RUNUT1JfU0laRSAoMSA8PCBMT19JVl9TRUNUT1JfQklUUykNCisNCiBzdHJ1 Y3QgbG9vcF9kZXZpY2Ugew0KIAlpbnQJCWxvX251bWJlcjsNCiAJaW50CQls b19yZWZjbnQ7DQpAQCAtNTYsNiArNjMsOCBAQA0KIAlzdHJ1Y3Qgc2VtYXBo b3JlCWxvX2N0bF9tdXRleDsNCiAJc3RydWN0IHNlbWFwaG9yZQlsb19iaF9t dXRleDsNCiAJYXRvbWljX3QJCWxvX3BlbmRpbmc7DQorDQorCWludAkJCWxv X2l2X21vZGU7DQogfTsNCiANCiB0eXBlZGVmCWludCAoKiB0cmFuc2Zlcl9w cm9jX3QpKHN0cnVjdCBsb29wX2RldmljZSAqLCBpbnQgY21kLA0KQEAgLTEy MSw2ICsxMzAsNyBAQA0KICNkZWZpbmUgTE9fQ1JZUFRfSURFQSAgICAgNg0K ICNkZWZpbmUgTE9fQ1JZUFRfRFVNTVkgICAgOQ0KICNkZWZpbmUgTE9fQ1JZ UFRfU0tJUEpBQ0sgMTANCisjZGVmaW5lIExPX0NSWVBUX0NSWVBUT0FQSSAx OCAgLyogaW50ZXJuYXRpb25hbCBjcnlwdG8gcGF0Y2ggKi8NCiAjZGVmaW5l IE1BWF9MT19DUllQVAkyMA0KIA0KICNpZmRlZiBfX0tFUk5FTF9fDQo= --856294657-1535242835-995797290=:15777-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/