diff options
author | Robert Baronescu <robert.baronescu@nxp.com> | 2017-10-10 06:22:00 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-11-03 09:50:47 -0400 |
commit | 7aacbfcb331ceff3ac43096d563a1f93ed46e35e (patch) | |
tree | e9f361deefc50f460b2119afaf055ed74562eb7d /crypto/tcrypt.c | |
parent | 59517226a35a4041e41d114d085846ac94ebfbf2 (diff) |
crypto: tcrypt - fix buffer lengths in test_aead_speed()
Fix the way the length of the buffers used for
encryption / decryption are computed.
For e.g. in case of encryption, input buffer does not contain
an authentication tag.
Signed-off-by: Robert Baronescu <robert.baronescu@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r-- | crypto/tcrypt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 28bffa6f0292..65d191b27ecc 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -340,7 +340,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, | |||
340 | } | 340 | } |
341 | 341 | ||
342 | sg_init_aead(sg, xbuf, | 342 | sg_init_aead(sg, xbuf, |
343 | *b_size + (enc ? authsize : 0)); | 343 | *b_size + (enc ? 0 : authsize)); |
344 | 344 | ||
345 | sg_init_aead(sgout, xoutbuf, | 345 | sg_init_aead(sgout, xoutbuf, |
346 | *b_size + (enc ? authsize : 0)); | 346 | *b_size + (enc ? authsize : 0)); |
@@ -348,7 +348,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, | |||
348 | sg_set_buf(&sg[0], assoc, aad_size); | 348 | sg_set_buf(&sg[0], assoc, aad_size); |
349 | sg_set_buf(&sgout[0], assoc, aad_size); | 349 | sg_set_buf(&sgout[0], assoc, aad_size); |
350 | 350 | ||
351 | aead_request_set_crypt(req, sg, sgout, *b_size, iv); | 351 | aead_request_set_crypt(req, sg, sgout, |
352 | *b_size + (enc ? 0 : authsize), | ||
353 | iv); | ||
352 | aead_request_set_ad(req, aad_size); | 354 | aead_request_set_ad(req, aad_size); |
353 | 355 | ||
354 | if (secs) | 356 | if (secs) |