aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Stoica <cristian.stoica@freescale.com>2015-01-28 06:07:32 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2015-02-04 04:59:42 -0500
commit96692a7305c49845e3cbf5a60cfcb207c5dc4030 (patch)
treea2afc355521cbe087c26e550c39a44995186a72e
parent424a5da6919073392c11345d1b7baa9f31c62734 (diff)
crypto: tcrypt - do not allocate iv on stack for aead speed tests
See also: 9bac019dad8098a77cce555d929f678e22111783 Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/tcrypt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 2b2486ad26ef..4b9e23fa4204 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -280,16 +280,20 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
280 struct scatterlist *sgout; 280 struct scatterlist *sgout;
281 const char *e; 281 const char *e;
282 void *assoc; 282 void *assoc;
283 char iv[MAX_IVLEN]; 283 char *iv;
284 char *xbuf[XBUFSIZE]; 284 char *xbuf[XBUFSIZE];
285 char *xoutbuf[XBUFSIZE]; 285 char *xoutbuf[XBUFSIZE];
286 char *axbuf[XBUFSIZE]; 286 char *axbuf[XBUFSIZE];
287 unsigned int *b_size; 287 unsigned int *b_size;
288 unsigned int iv_len; 288 unsigned int iv_len;
289 289
290 iv = kzalloc(MAX_IVLEN, GFP_KERNEL);
291 if (!iv)
292 return;
293
290 if (aad_size >= PAGE_SIZE) { 294 if (aad_size >= PAGE_SIZE) {
291 pr_err("associate data length (%u) too big\n", aad_size); 295 pr_err("associate data length (%u) too big\n", aad_size);
292 return; 296 goto out_noxbuf;
293 } 297 }
294 298
295 if (enc == ENCRYPT) 299 if (enc == ENCRYPT)
@@ -355,7 +359,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
355 359
356 iv_len = crypto_aead_ivsize(tfm); 360 iv_len = crypto_aead_ivsize(tfm);
357 if (iv_len) 361 if (iv_len)
358 memset(&iv, 0xff, iv_len); 362 memset(iv, 0xff, iv_len);
359 363
360 crypto_aead_clear_flags(tfm, ~0); 364 crypto_aead_clear_flags(tfm, ~0);
361 printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ", 365 printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
@@ -408,6 +412,7 @@ out_nooutbuf:
408out_noaxbuf: 412out_noaxbuf:
409 testmgr_free_buf(xbuf); 413 testmgr_free_buf(xbuf);
410out_noxbuf: 414out_noxbuf:
415 kfree(iv);
411 return; 416 return;
412} 417}
413 418