From 8df6f07de1e252f9ffa45cacd667fe0af41d71c1 Mon Sep 17 00:00:00 2001 From: Cristian Stoica Date: Wed, 12 Mar 2014 15:15:51 +0200 Subject: crypto: testmgr - code clean-up on TLS tests Change-Id: Ic1248e27fabf787434dabd1303e0bdfdd78732b6 Signed-off-by: Cristian Stoica Reviewed-on: http://git.am.freescale.net:8181/10083 Tested-by: Review Code-CDREVIEW Reviewed-by: Horia Ioan Geanta Neag Reviewed-by: Jose Rivera (cherry picked from commit d076de0815bfd49181d8d660349ccc1f69e27932) Reviewed-on: http://git.am.freescale.net:8181/10382 Reviewed-by: Mircea Pop Reviewed-by: Alexandru Porosanu diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 6221c54..c8bfd5f 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -845,21 +845,14 @@ static int __test_tls(struct crypto_aead *tfm, int enc, sg = kmalloc(sizeof(*sg) * 8 * (diff_dst ? 3 : 2), GFP_KERNEL); if (!sg) goto out_nosg; - asg = &sg[8]; - sgout = &asg[8]; - if (diff_dst) - d = "-ddst"; - else - d = ""; + asg = sg + 8; + sgout = sg + 16; - if (enc == ENCRYPT) - e = "encryption"; - else - e = "decryption"; + d = diff_dst ? "-ddst" : ""; + e = enc ? "encryption" : "decryption"; init_completion(&result.completion); - req = aead_request_alloc(tfm, GFP_KERNEL); if (!req) { pr_err("alg: tls%s: Failed to allocate request for %s\n", @@ -898,8 +891,6 @@ static int __test_tls(struct crypto_aead *tfm, int enc, if (ret) continue; - output = diff_dst ? xoutbuf[0] : input; - /* Allocate enough space in the input and output scatterlists. * They must accomodate the result for in-place encryption and * different-place decryption @@ -915,7 +906,6 @@ static int __test_tls(struct crypto_aead *tfm, int enc, } sg_init_one(&asg[0], assoc, template[i].alen); - aead_request_set_assoc(req, asg, template[i].alen); aead_request_set_crypt(req, sg, (diff_dst) ? sgout : sg, template[i].ilen, iv); -- cgit v0.10.2