diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 7ffe9dcba42e..633e8075d22c 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -256,7 +256,7 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs, unsigned int i, j, iv_len; const char *key; const char *e; - void *assoc; + void *assoc, *assoc_out; u32 *b_size; char *iv; int ret; @@ -376,6 +376,8 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs, assoc = cur->axbuf[0]; memset(assoc, 0xff, aad_size); + assoc_out = cur->axbuf[1]; + memset(assoc_out, 0xff, aad_size); sg_init_aead(cur->sg, cur->xbuf, *b_size + (enc ? 0 : authsize), @@ -383,7 +385,7 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs, sg_init_aead(cur->sgout, cur->xoutbuf, *b_size + (enc ? authsize : 0), - assoc, aad_size); + assoc_out, aad_size); aead_request_set_ad(cur->req, aad_size); @@ -401,6 +403,9 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs, ret); break; } + + memset(assoc, 0xff, aad_size); + memset(assoc_out, 0xff, aad_size); } aead_request_set_crypt(cur->req, cur->sg, @@ -527,7 +532,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, struct scatterlist *sg; struct scatterlist *sgout; const char *e; - void *assoc; + void *assoc, *assoc_out; char *iv; char *xbuf[XBUFSIZE]; char *xoutbuf[XBUFSIZE]; @@ -590,6 +595,8 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, do { assoc = axbuf[0]; memset(assoc, 0xff, aad_size); + assoc_out = axbuf[1]; + memset(assoc_out, 0xff, aad_size); if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { pr_err("template (%u) too big for tvmem (%lu)\n", @@ -629,7 +636,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, assoc, aad_size); sg_init_aead(sgout, xoutbuf, - *b_size + (enc ? authsize : 0), assoc, + *b_size + (enc ? authsize : 0), assoc_out, aad_size); aead_request_set_ad(req, aad_size); @@ -651,6 +658,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, ret); break; } + + memset(assoc, 0xff, aad_size); + memset(assoc_out, 0xff, aad_size); } aead_request_set_crypt(req, sg, sgout,