summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorCristian Stoica <cristian.stoica@freescale.com>2015-01-28 10:03:05 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2015-02-04 10:59:41 +0100
commit424a5da6919073392c11345d1b7baa9f31c62734 (patch)
tree7bab3bfde78c5be061b7dd28e0a18934221d3702 /crypto/testmgr.c
parentcrypto: tcrypt - fix buflen reminder calculation (diff)
downloadlinux-424a5da6919073392c11345d1b7baa9f31c62734.tar.xz
linux-424a5da6919073392c11345d1b7baa9f31c62734.zip
crypto: testmgr - limit IV copy length in aead tests
The working copy of IV is the same size as the transformation's IV. It is not necessary to copy more than that from the template since iv_len is usually less than MAX_IVLEN and the rest of the copied data is garbage. Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 758d02847308..f4ed6d4205e7 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -429,7 +429,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
struct scatterlist *sgout;
const char *e, *d;
struct tcrypt_result result;
- unsigned int authsize;
+ unsigned int authsize, iv_len;
void *input;
void *output;
void *assoc;
@@ -500,10 +500,11 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
memcpy(input, template[i].input, template[i].ilen);
memcpy(assoc, template[i].assoc, template[i].alen);
+ iv_len = crypto_aead_ivsize(tfm);
if (template[i].iv)
- memcpy(iv, template[i].iv, MAX_IVLEN);
+ memcpy(iv, template[i].iv, iv_len);
else
- memset(iv, 0, MAX_IVLEN);
+ memset(iv, 0, iv_len);
crypto_aead_clear_flags(tfm, ~0);
if (template[i].wk)