Thread (11 messages) flat view 11 messages, 5 authors, 2012-09-09

Re: Linux 3.6-rc5

From: Jussi Kivilinna <hidden>
Date: 2012-09-09 20:54:11
Also in: lkml
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

Possibly related (same subject, not in this thread)

Quoting Herbert Xu [off-list ref]:
On Sun, Sep 09, 2012 at 08:35:56AM -0700, Linus Torvalds wrote:
quoted
On Sun, Sep 9, 2012 at 5:54 AM, Jussi Kivilinna
[off-list ref] wrote:
quoted
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?

-Jussi
Cheers,
--
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help