]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: authenc - Fix crash with zero-length assoc data
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 11 Sep 2012 04:05:45 +0000 (12:05 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 11 Sep 2012 04:05:45 +0000 (12:05 +0800)
commitab6bcf27979522962d599d4f9f770472d4ff36f3
treeeb9a4d9fa6a66bf95cd60ff76e2ebc46ccb59115
parentd109dd1595dd900baf75bc3f0510151d73d8cfd3
crypto: authenc - Fix crash with zero-length assoc data

The authenc code doesn't deal with zero-length associated data
correctly and ends up constructing a zero-length sg entry which
causes a crash when it's fed into the crypto system.

This patch fixes this by avoiding the code-path that triggers
the SG construction if we have no associated data.

This isn't the most optimal fix as it means that we'll end up
using the fallback code-path even when we could still execute
the digest function.  However, this isn't a big deal as nobody
but the test path would supply zero-length associated data.

Reported-by: Romain Francoise <romain@orebokech.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Romain Francoise <romain@orebokech.com>
crypto/authenc.c