summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Stoica <cristian.stoica@freescale.com>2015-01-28 13:07:32 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2015-02-04 20:59:42 +1100
commitee331ed90ef034b75b98ebddbb1db8b3969d78f0 (patch)
tree572a88ab09c30e9f3c69b82b95f6f59511dbd2b2
parent2e037a4bc5daed2cd453599a3a8420ad2ef199c5 (diff)
downloadlinux-crypto-ee331ed90ef034b75b98ebddbb1db8b3969d78f0.tar.gz
linux-crypto-ee331ed90ef034b75b98ebddbb1db8b3969d78f0.zip
crypto: tcrypt - do not allocate iv on stack for aead speed tests
See also: b5f1234285bca12041a01cc3bc83d824c2f27ee5 Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--crypto/tcrypt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 2b2486ad..4b9e23fa 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,
struct scatterlist *sgout;
const char *e;
void *assoc;
- char iv[MAX_IVLEN];
+ char *iv;
char *xbuf[XBUFSIZE];
char *xoutbuf[XBUFSIZE];
char *axbuf[XBUFSIZE];
unsigned int *b_size;
unsigned int iv_len;
+ iv = kzalloc(MAX_IVLEN, GFP_KERNEL);
+ if (!iv)
+ return;
+
if (aad_size >= PAGE_SIZE) {
pr_err("associate data length (%u) too big\n", aad_size);
- return;
+ goto out_noxbuf;
}
if (enc == ENCRYPT)
@@ -355,7 +359,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
iv_len = crypto_aead_ivsize(tfm);
if (iv_len)
- memset(&iv, 0xff, iv_len);
+ memset(iv, 0xff, iv_len);
crypto_aead_clear_flags(tfm, ~0);
printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
@@ -408,6 +412,7 @@ out_nooutbuf:
out_noaxbuf:
testmgr_free_buf(xbuf);
out_noxbuf:
+ kfree(iv);
return;
}