diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2017-07-17 03:32:30 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-07-18 05:01:11 -0400 |
commit | 41cdf7a45389e01991ee31e3301ed83cb3e3f7dc (patch) | |
tree | df34fc42687bb28c8d800fb71bb6b0bf1eaa1973 | |
parent | efc856edfd66acc5da34fec92d7feca6fd0f9add (diff) |
crypto: authencesn - Fix digest_null crash
When authencesn is used together with digest_null a crash will
occur on the decrypt path. This is because normally we perform
a special setup to preserve the ESN, but this is skipped if there
is no authentication. However, on the post-authentication path
it always expects the preservation to be in place, thus causing
a crash when digest_null is used.
This patch fixes this by also skipping the post-processing when
there is no authentication.
Fixes: 104880a6b470 ("crypto: authencesn - Convert to new AEAD...")
Cc: <stable@vger.kernel.org>
Reported-by: Jan Tluka <jtluka@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/authencesn.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/authencesn.c b/crypto/authencesn.c index 6f8f6b86bfe2..0cf5fefdb859 100644 --- a/crypto/authencesn.c +++ b/crypto/authencesn.c | |||
@@ -248,6 +248,9 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req, | |||
248 | u8 *ihash = ohash + crypto_ahash_digestsize(auth); | 248 | u8 *ihash = ohash + crypto_ahash_digestsize(auth); |
249 | u32 tmp[2]; | 249 | u32 tmp[2]; |
250 | 250 | ||
251 | if (!authsize) | ||
252 | goto decrypt; | ||
253 | |||
251 | /* Move high-order bits of sequence number back. */ | 254 | /* Move high-order bits of sequence number back. */ |
252 | scatterwalk_map_and_copy(tmp, dst, 4, 4, 0); | 255 | scatterwalk_map_and_copy(tmp, dst, 4, 4, 0); |
253 | scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 0); | 256 | scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 0); |
@@ -256,6 +259,8 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req, | |||
256 | if (crypto_memneq(ihash, ohash, authsize)) | 259 | if (crypto_memneq(ihash, ohash, authsize)) |
257 | return -EBADMSG; | 260 | return -EBADMSG; |
258 | 261 | ||
262 | decrypt: | ||
263 | |||
259 | sg_init_table(areq_ctx->dst, 2); | 264 | sg_init_table(areq_ctx->dst, 2); |
260 | dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen); | 265 | dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen); |
261 | 266 | ||