lkml.org 
[lkml]   [2014]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] crypto: testmgr.c: delay execution of set-up code
Date
Prepare IV array only if the dependent code is executed.

Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
---
crypto/testmgr.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 36f45ff..365f8a3 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -969,16 +969,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;
@@ -1046,16 +1045,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);
--
1.8.3.1


\
 
 \ /
  Last update: 2014-08-08 13:41    [W:0.054 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site