Re: Linux 3.6-rc5

From: Jussi Kivilinna
Date: Sun Sep 09 2012 - 16:54:03 EST

Quoting Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>:

On Sun, Sep 09, 2012 at 08:35:56AM -0700, Linus Torvalds wrote:
On Sun, Sep 9, 2012 at 5:54 AM, Jussi Kivilinna
<jussi.kivilinna@xxxxxxxx> wrote:
> Does reverting e46e9a46386bca8e80a6467b5c643dc494861896 help?
> That commit added crypto selftest for authenc(hmac(sha1),cbc(aes)) in 3.6,
> and probably made this bug visible (but not directly causing it).

So Romain said it does - where do we go from here? Revert testing it,
or fix the authenc() case? I'd prefer the fix..

I'm working on this right now. If we don't get anywhere in a
couple of days we can revert the test vector patch.

It seems that authenc is chaining empty assoc scatterlist, which causes
BUG_ON(!sg->length) set off in crypto/scatterwalk.c.

Following fixes the bug and self-test passes, but not sure if it's correct
(note, copy-paste to 'broken' email client, most likely does not apply etc):

diff --git a/crypto/authenc.c b/crypto/authenc.c
index 5ef7ba6..2373af5 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -336,7 +336,7 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv,
cryptlen += ivsize;

- if (sg_is_last(assoc)) {
+ if (req->assoclen > 0 && sg_is_last(assoc)) {
authenc_ahash_fn = crypto_authenc_ahash;
sg_init_table(asg, 2);
sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset);

Also does crypto_authenc_iverify() need same fix?


Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page:
PGP Key:

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at