summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorCristian Stoica <cristian.stoica@freescale.com>2014-08-08 14:27:52 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2014-08-25 20:27:18 +0800
commitbbb9a7dd7fd1ec076b034e6f5bce3fb5a215f050 (patch)
tree7ceb161c28576825c336b760154f9123b3b71e03 /crypto
parenta1aa44a2eb498d17e725578f5c30c160a8ed9f8d (diff)
downloadlinux-stable-bbb9a7dd7fd1ec076b034e6f5bce3fb5a215f050.tar.gz
linux-stable-bbb9a7dd7fd1ec076b034e6f5bce3fb5a215f050.tar.bz2
linux-stable-bbb9a7dd7fd1ec076b034e6f5bce3fb5a215f050.zip
crypto: testmgr - delay execution of set-up code
Prepare IV array only if the dependent code is executed. Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/testmgr.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 7fe4225b5513..f217c622bc41 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -961,16 +961,15 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
j = 0;
for (i = 0; i < tcount; i++) {
+ if (template[i].np && !template[i].also_non_np)
+ continue;
+
if (template[i].iv)
memcpy(iv, template[i].iv, MAX_IVLEN);
else
memset(iv, 0, MAX_IVLEN);
- if (template[i].np && !template[i].also_non_np)
- continue;
-
j++;
-
ret = -EINVAL;
if (WARN_ON(align_offset + template[i].ilen > PAGE_SIZE))
goto out;
@@ -1038,16 +1037,15 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
if (align_offset != 0)
break;
+ if (!template[i].np)
+ continue;
+
if (template[i].iv)
memcpy(iv, template[i].iv, MAX_IVLEN);
else
memset(iv, 0, MAX_IVLEN);
- if (!template[i].np)
- continue;
-
j++;
-
crypto_ablkcipher_clear_flags(tfm, ~0);
if (template[i].wk)
crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY);