aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-27 04:03:51 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-27 23:23:21 -0400
commita3f2185a29df084611641e964aa93d1a6ee2212c (patch)
tree249c55202be84e52c337423deaa1311ca5436e47 /crypto/tcrypt.c
parent957e0fe6292372460bdace9c2a67a857379ad1db (diff)
crypto: tcrypt - Switch to new AEAD interface
This patch makes use of the new AEAD interface which uses a single SG list instead of separate lists for the AD and plain text. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r--crypto/tcrypt.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 2bff6130d806..4b4a9313f308 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -277,7 +277,6 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
277 const char *key; 277 const char *key;
278 struct aead_request *req; 278 struct aead_request *req;
279 struct scatterlist *sg; 279 struct scatterlist *sg;
280 struct scatterlist *asg;
281 struct scatterlist *sgout; 280 struct scatterlist *sgout;
282 const char *e; 281 const char *e;
283 void *assoc; 282 void *assoc;
@@ -309,11 +308,10 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
309 if (testmgr_alloc_buf(xoutbuf)) 308 if (testmgr_alloc_buf(xoutbuf))
310 goto out_nooutbuf; 309 goto out_nooutbuf;
311 310
312 sg = kmalloc(sizeof(*sg) * 8 * 3, GFP_KERNEL); 311 sg = kmalloc(sizeof(*sg) * 9 * 2, GFP_KERNEL);
313 if (!sg) 312 if (!sg)
314 goto out_nosg; 313 goto out_nosg;
315 asg = &sg[8]; 314 sgout = &sg[9];
316 sgout = &asg[8];
317 315
318 tfm = crypto_alloc_aead(algo, 0, 0); 316 tfm = crypto_alloc_aead(algo, 0, 0);
319 317
@@ -339,7 +337,8 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
339 do { 337 do {
340 assoc = axbuf[0]; 338 assoc = axbuf[0];
341 memset(assoc, 0xff, aad_size); 339 memset(assoc, 0xff, aad_size);
342 sg_init_one(&asg[0], assoc, aad_size); 340 sg_set_buf(&sg[0], assoc, aad_size);
341 sg_set_buf(&sgout[0], assoc, aad_size);
343 342
344 if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { 343 if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
345 pr_err("template (%u) too big for tvmem (%lu)\n", 344 pr_err("template (%u) too big for tvmem (%lu)\n",
@@ -375,14 +374,14 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
375 goto out; 374 goto out;
376 } 375 }
377 376
378 sg_init_aead(&sg[0], xbuf, 377 sg_init_aead(&sg[1], xbuf,
379 *b_size + (enc ? authsize : 0)); 378 *b_size + (enc ? authsize : 0));
380 379
381 sg_init_aead(&sgout[0], xoutbuf, 380 sg_init_aead(&sgout[1], xoutbuf,
382 *b_size + (enc ? authsize : 0)); 381 *b_size + (enc ? authsize : 0));
383 382
384 aead_request_set_crypt(req, sg, sgout, *b_size, iv); 383 aead_request_set_crypt(req, sg, sgout, *b_size, iv);
385 aead_request_set_assoc(req, asg, aad_size); 384 aead_request_set_ad(req, aad_size);
386 385
387 if (secs) 386 if (secs)
388 ret = test_aead_jiffies(req, enc, *b_size, 387 ret = test_aead_jiffies(req, enc, *b_size,