crypto: tcrypt - do not allocate iv on stack for aead speed tests
See also: 9bac019dad
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
424a5da691
commit
96692a7305
|
@ -280,16 +280,20 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
|
||||||
struct scatterlist *sgout;
|
struct scatterlist *sgout;
|
||||||
const char *e;
|
const char *e;
|
||||||
void *assoc;
|
void *assoc;
|
||||||
char iv[MAX_IVLEN];
|
char *iv;
|
||||||
char *xbuf[XBUFSIZE];
|
char *xbuf[XBUFSIZE];
|
||||||
char *xoutbuf[XBUFSIZE];
|
char *xoutbuf[XBUFSIZE];
|
||||||
char *axbuf[XBUFSIZE];
|
char *axbuf[XBUFSIZE];
|
||||||
unsigned int *b_size;
|
unsigned int *b_size;
|
||||||
unsigned int iv_len;
|
unsigned int iv_len;
|
||||||
|
|
||||||
|
iv = kzalloc(MAX_IVLEN, GFP_KERNEL);
|
||||||
|
if (!iv)
|
||||||
|
return;
|
||||||
|
|
||||||
if (aad_size >= PAGE_SIZE) {
|
if (aad_size >= PAGE_SIZE) {
|
||||||
pr_err("associate data length (%u) too big\n", aad_size);
|
pr_err("associate data length (%u) too big\n", aad_size);
|
||||||
return;
|
goto out_noxbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc == ENCRYPT)
|
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);
|
iv_len = crypto_aead_ivsize(tfm);
|
||||||
if (iv_len)
|
if (iv_len)
|
||||||
memset(&iv, 0xff, iv_len);
|
memset(iv, 0xff, iv_len);
|
||||||
|
|
||||||
crypto_aead_clear_flags(tfm, ~0);
|
crypto_aead_clear_flags(tfm, ~0);
|
||||||
printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
|
printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
|
||||||
|
@ -408,6 +412,7 @@ out_nooutbuf:
|
||||||
out_noaxbuf:
|
out_noaxbuf:
|
||||||
testmgr_free_buf(xbuf);
|
testmgr_free_buf(xbuf);
|
||||||
out_noxbuf:
|
out_noxbuf:
|
||||||
|
kfree(iv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user