aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorMark Rustad <mark.d.rustad@intel.com>2014-07-25 05:53:38 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-08-01 10:35:55 -0400
commit3e3dc25fe7d5e33026bdfca5e8fab08be6a8729c (patch)
treec6ee3c7f38cfbca84b292c128a1a0d2e5fbb170b /crypto
parent4839ddcaba266bcf37dfb00757f339ab9de4710e (diff)
crypto: Resolve shadow warnings
Change formal parameters to not clash with global names to eliminate many W=2 warnings. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/cryptd.c12
-rw-r--r--crypto/eseqiv.c8
-rw-r--r--crypto/gcm.c30
-rw-r--r--crypto/seqiv.c16
-rw-r--r--crypto/tcrypt.c77
5 files changed, 72 insertions, 71 deletions
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 7bdd61b867c8..e592c90abebb 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -233,7 +233,7 @@ static void cryptd_blkcipher_decrypt(struct crypto_async_request *req, int err)
233} 233}
234 234
235static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req, 235static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req,
236 crypto_completion_t complete) 236 crypto_completion_t compl)
237{ 237{
238 struct cryptd_blkcipher_request_ctx *rctx = ablkcipher_request_ctx(req); 238 struct cryptd_blkcipher_request_ctx *rctx = ablkcipher_request_ctx(req);
239 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); 239 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req);
@@ -241,7 +241,7 @@ static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req,
241 241
242 queue = cryptd_get_queue(crypto_ablkcipher_tfm(tfm)); 242 queue = cryptd_get_queue(crypto_ablkcipher_tfm(tfm));
243 rctx->complete = req->base.complete; 243 rctx->complete = req->base.complete;
244 req->base.complete = complete; 244 req->base.complete = compl;
245 245
246 return cryptd_enqueue_request(queue, &req->base); 246 return cryptd_enqueue_request(queue, &req->base);
247} 247}
@@ -414,7 +414,7 @@ static int cryptd_hash_setkey(struct crypto_ahash *parent,
414} 414}
415 415
416static int cryptd_hash_enqueue(struct ahash_request *req, 416static int cryptd_hash_enqueue(struct ahash_request *req,
417 crypto_completion_t complete) 417 crypto_completion_t compl)
418{ 418{
419 struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); 419 struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req);
420 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 420 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
@@ -422,7 +422,7 @@ static int cryptd_hash_enqueue(struct ahash_request *req,
422 cryptd_get_queue(crypto_ahash_tfm(tfm)); 422 cryptd_get_queue(crypto_ahash_tfm(tfm));
423 423
424 rctx->complete = req->base.complete; 424 rctx->complete = req->base.complete;
425 req->base.complete = complete; 425 req->base.complete = compl;
426 426
427 return cryptd_enqueue_request(queue, &req->base); 427 return cryptd_enqueue_request(queue, &req->base);
428} 428}
@@ -667,14 +667,14 @@ static void cryptd_aead_decrypt(struct crypto_async_request *areq, int err)
667} 667}
668 668
669static int cryptd_aead_enqueue(struct aead_request *req, 669static int cryptd_aead_enqueue(struct aead_request *req,
670 crypto_completion_t complete) 670 crypto_completion_t compl)
671{ 671{
672 struct cryptd_aead_request_ctx *rctx = aead_request_ctx(req); 672 struct cryptd_aead_request_ctx *rctx = aead_request_ctx(req);
673 struct crypto_aead *tfm = crypto_aead_reqtfm(req); 673 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
674 struct cryptd_queue *queue = cryptd_get_queue(crypto_aead_tfm(tfm)); 674 struct cryptd_queue *queue = cryptd_get_queue(crypto_aead_tfm(tfm));
675 675
676 rctx->complete = req->base.complete; 676 rctx->complete = req->base.complete;
677 req->base.complete = complete; 677 req->base.complete = compl;
678 return cryptd_enqueue_request(queue, &req->base); 678 return cryptd_enqueue_request(queue, &req->base);
679} 679}
680 680
diff --git a/crypto/eseqiv.c b/crypto/eseqiv.c
index 42ce9f570aec..bf7ab4a89493 100644
--- a/crypto/eseqiv.c
+++ b/crypto/eseqiv.c
@@ -68,7 +68,7 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req)
68 struct eseqiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); 68 struct eseqiv_ctx *ctx = crypto_ablkcipher_ctx(geniv);
69 struct eseqiv_request_ctx *reqctx = skcipher_givcrypt_reqctx(req); 69 struct eseqiv_request_ctx *reqctx = skcipher_givcrypt_reqctx(req);
70 struct ablkcipher_request *subreq; 70 struct ablkcipher_request *subreq;
71 crypto_completion_t complete; 71 crypto_completion_t compl;
72 void *data; 72 void *data;
73 struct scatterlist *osrc, *odst; 73 struct scatterlist *osrc, *odst;
74 struct scatterlist *dst; 74 struct scatterlist *dst;
@@ -86,7 +86,7 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req)
86 ablkcipher_request_set_tfm(subreq, skcipher_geniv_cipher(geniv)); 86 ablkcipher_request_set_tfm(subreq, skcipher_geniv_cipher(geniv));
87 87
88 giv = req->giv; 88 giv = req->giv;
89 complete = req->creq.base.complete; 89 compl = req->creq.base.complete;
90 data = req->creq.base.data; 90 data = req->creq.base.data;
91 91
92 osrc = req->creq.src; 92 osrc = req->creq.src;
@@ -101,11 +101,11 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req)
101 if (vsrc != giv + ivsize && vdst != giv + ivsize) { 101 if (vsrc != giv + ivsize && vdst != giv + ivsize) {
102 giv = PTR_ALIGN((u8 *)reqctx->tail, 102 giv = PTR_ALIGN((u8 *)reqctx->tail,
103 crypto_ablkcipher_alignmask(geniv) + 1); 103 crypto_ablkcipher_alignmask(geniv) + 1);
104 complete = eseqiv_complete; 104 compl = eseqiv_complete;
105 data = req; 105 data = req;
106 } 106 }
107 107
108 ablkcipher_request_set_callback(subreq, req->creq.base.flags, complete, 108 ablkcipher_request_set_callback(subreq, req->creq.base.flags, compl,
109 data); 109 data);
110 110
111 sg_init_table(reqctx->src, 2); 111 sg_init_table(reqctx->src, 2);
diff --git a/crypto/gcm.c b/crypto/gcm.c
index b4f017939004..276cdac567b6 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -228,14 +228,14 @@ static void gcm_hash_final_done(struct crypto_async_request *areq, int err);
228 228
229static int gcm_hash_update(struct aead_request *req, 229static int gcm_hash_update(struct aead_request *req,
230 struct crypto_gcm_req_priv_ctx *pctx, 230 struct crypto_gcm_req_priv_ctx *pctx,
231 crypto_completion_t complete, 231 crypto_completion_t compl,
232 struct scatterlist *src, 232 struct scatterlist *src,
233 unsigned int len) 233 unsigned int len)
234{ 234{
235 struct ahash_request *ahreq = &pctx->u.ahreq; 235 struct ahash_request *ahreq = &pctx->u.ahreq;
236 236
237 ahash_request_set_callback(ahreq, aead_request_flags(req), 237 ahash_request_set_callback(ahreq, aead_request_flags(req),
238 complete, req); 238 compl, req);
239 ahash_request_set_crypt(ahreq, src, NULL, len); 239 ahash_request_set_crypt(ahreq, src, NULL, len);
240 240
241 return crypto_ahash_update(ahreq); 241 return crypto_ahash_update(ahreq);
@@ -244,12 +244,12 @@ static int gcm_hash_update(struct aead_request *req,
244static int gcm_hash_remain(struct aead_request *req, 244static int gcm_hash_remain(struct aead_request *req,
245 struct crypto_gcm_req_priv_ctx *pctx, 245 struct crypto_gcm_req_priv_ctx *pctx,
246 unsigned int remain, 246 unsigned int remain,
247 crypto_completion_t complete) 247 crypto_completion_t compl)
248{ 248{
249 struct ahash_request *ahreq = &pctx->u.ahreq; 249 struct ahash_request *ahreq = &pctx->u.ahreq;
250 250
251 ahash_request_set_callback(ahreq, aead_request_flags(req), 251 ahash_request_set_callback(ahreq, aead_request_flags(req),
252 complete, req); 252 compl, req);
253 sg_init_one(pctx->src, gcm_zeroes, remain); 253 sg_init_one(pctx->src, gcm_zeroes, remain);
254 ahash_request_set_crypt(ahreq, pctx->src, NULL, remain); 254 ahash_request_set_crypt(ahreq, pctx->src, NULL, remain);
255 255
@@ -375,14 +375,14 @@ static void __gcm_hash_assoc_remain_done(struct aead_request *req, int err)
375{ 375{
376 struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req); 376 struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);
377 struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx; 377 struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx;
378 crypto_completion_t complete; 378 crypto_completion_t compl;
379 unsigned int remain = 0; 379 unsigned int remain = 0;
380 380
381 if (!err && gctx->cryptlen) { 381 if (!err && gctx->cryptlen) {
382 remain = gcm_remain(gctx->cryptlen); 382 remain = gcm_remain(gctx->cryptlen);
383 complete = remain ? gcm_hash_crypt_done : 383 compl = remain ? gcm_hash_crypt_done :
384 gcm_hash_crypt_remain_done; 384 gcm_hash_crypt_remain_done;
385 err = gcm_hash_update(req, pctx, complete, 385 err = gcm_hash_update(req, pctx, compl,
386 gctx->src, gctx->cryptlen); 386 gctx->src, gctx->cryptlen);
387 if (err == -EINPROGRESS || err == -EBUSY) 387 if (err == -EINPROGRESS || err == -EBUSY)
388 return; 388 return;
@@ -429,14 +429,14 @@ static void gcm_hash_assoc_done(struct crypto_async_request *areq, int err)
429static void __gcm_hash_init_done(struct aead_request *req, int err) 429static void __gcm_hash_init_done(struct aead_request *req, int err)
430{ 430{
431 struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req); 431 struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);
432 crypto_completion_t complete; 432 crypto_completion_t compl;
433 unsigned int remain = 0; 433 unsigned int remain = 0;
434 434
435 if (!err && req->assoclen) { 435 if (!err && req->assoclen) {
436 remain = gcm_remain(req->assoclen); 436 remain = gcm_remain(req->assoclen);
437 complete = remain ? gcm_hash_assoc_done : 437 compl = remain ? gcm_hash_assoc_done :
438 gcm_hash_assoc_remain_done; 438 gcm_hash_assoc_remain_done;
439 err = gcm_hash_update(req, pctx, complete, 439 err = gcm_hash_update(req, pctx, compl,
440 req->assoc, req->assoclen); 440 req->assoc, req->assoclen);
441 if (err == -EINPROGRESS || err == -EBUSY) 441 if (err == -EINPROGRESS || err == -EBUSY)
442 return; 442 return;
@@ -462,7 +462,7 @@ static int gcm_hash(struct aead_request *req,
462 struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx; 462 struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx;
463 struct crypto_gcm_ctx *ctx = crypto_tfm_ctx(req->base.tfm); 463 struct crypto_gcm_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
464 unsigned int remain; 464 unsigned int remain;
465 crypto_completion_t complete; 465 crypto_completion_t compl;
466 int err; 466 int err;
467 467
468 ahash_request_set_tfm(ahreq, ctx->ghash); 468 ahash_request_set_tfm(ahreq, ctx->ghash);
@@ -473,8 +473,8 @@ static int gcm_hash(struct aead_request *req,
473 if (err) 473 if (err)
474 return err; 474 return err;
475 remain = gcm_remain(req->assoclen); 475 remain = gcm_remain(req->assoclen);
476 complete = remain ? gcm_hash_assoc_done : gcm_hash_assoc_remain_done; 476 compl = remain ? gcm_hash_assoc_done : gcm_hash_assoc_remain_done;
477 err = gcm_hash_update(req, pctx, complete, req->assoc, req->assoclen); 477 err = gcm_hash_update(req, pctx, compl, req->assoc, req->assoclen);
478 if (err) 478 if (err)
479 return err; 479 return err;
480 if (remain) { 480 if (remain) {
@@ -484,8 +484,8 @@ static int gcm_hash(struct aead_request *req,
484 return err; 484 return err;
485 } 485 }
486 remain = gcm_remain(gctx->cryptlen); 486 remain = gcm_remain(gctx->cryptlen);
487 complete = remain ? gcm_hash_crypt_done : gcm_hash_crypt_remain_done; 487 compl = remain ? gcm_hash_crypt_done : gcm_hash_crypt_remain_done;
488 err = gcm_hash_update(req, pctx, complete, gctx->src, gctx->cryptlen); 488 err = gcm_hash_update(req, pctx, compl, gctx->src, gctx->cryptlen);
489 if (err) 489 if (err)
490 return err; 490 return err;
491 if (remain) { 491 if (remain) {
diff --git a/crypto/seqiv.c b/crypto/seqiv.c
index f2cba4ed6f25..ee190fcedcd2 100644
--- a/crypto/seqiv.c
+++ b/crypto/seqiv.c
@@ -100,7 +100,7 @@ static int seqiv_givencrypt(struct skcipher_givcrypt_request *req)
100 struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); 100 struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req);
101 struct seqiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); 101 struct seqiv_ctx *ctx = crypto_ablkcipher_ctx(geniv);
102 struct ablkcipher_request *subreq = skcipher_givcrypt_reqctx(req); 102 struct ablkcipher_request *subreq = skcipher_givcrypt_reqctx(req);
103 crypto_completion_t complete; 103 crypto_completion_t compl;
104 void *data; 104 void *data;
105 u8 *info; 105 u8 *info;
106 unsigned int ivsize; 106 unsigned int ivsize;
@@ -108,7 +108,7 @@ static int seqiv_givencrypt(struct skcipher_givcrypt_request *req)
108 108
109 ablkcipher_request_set_tfm(subreq, skcipher_geniv_cipher(geniv)); 109 ablkcipher_request_set_tfm(subreq, skcipher_geniv_cipher(geniv));
110 110
111 complete = req->creq.base.complete; 111 compl = req->creq.base.complete;
112 data = req->creq.base.data; 112 data = req->creq.base.data;
113 info = req->creq.info; 113 info = req->creq.info;
114 114
@@ -122,11 +122,11 @@ static int seqiv_givencrypt(struct skcipher_givcrypt_request *req)
122 if (!info) 122 if (!info)
123 return -ENOMEM; 123 return -ENOMEM;
124 124
125 complete = seqiv_complete; 125 compl = seqiv_complete;
126 data = req; 126 data = req;
127 } 127 }
128 128
129 ablkcipher_request_set_callback(subreq, req->creq.base.flags, complete, 129 ablkcipher_request_set_callback(subreq, req->creq.base.flags, compl,
130 data); 130 data);
131 ablkcipher_request_set_crypt(subreq, req->creq.src, req->creq.dst, 131 ablkcipher_request_set_crypt(subreq, req->creq.src, req->creq.dst,
132 req->creq.nbytes, info); 132 req->creq.nbytes, info);
@@ -146,7 +146,7 @@ static int seqiv_aead_givencrypt(struct aead_givcrypt_request *req)
146 struct seqiv_ctx *ctx = crypto_aead_ctx(geniv); 146 struct seqiv_ctx *ctx = crypto_aead_ctx(geniv);
147 struct aead_request *areq = &req->areq; 147 struct aead_request *areq = &req->areq;
148 struct aead_request *subreq = aead_givcrypt_reqctx(req); 148 struct aead_request *subreq = aead_givcrypt_reqctx(req);
149 crypto_completion_t complete; 149 crypto_completion_t compl;
150 void *data; 150 void *data;
151 u8 *info; 151 u8 *info;
152 unsigned int ivsize; 152 unsigned int ivsize;
@@ -154,7 +154,7 @@ static int seqiv_aead_givencrypt(struct aead_givcrypt_request *req)
154 154
155 aead_request_set_tfm(subreq, aead_geniv_base(geniv)); 155 aead_request_set_tfm(subreq, aead_geniv_base(geniv));
156 156
157 complete = areq->base.complete; 157 compl = areq->base.complete;
158 data = areq->base.data; 158 data = areq->base.data;
159 info = areq->iv; 159 info = areq->iv;
160 160
@@ -168,11 +168,11 @@ static int seqiv_aead_givencrypt(struct aead_givcrypt_request *req)
168 if (!info) 168 if (!info)
169 return -ENOMEM; 169 return -ENOMEM;
170 170
171 complete = seqiv_aead_complete; 171 compl = seqiv_aead_complete;
172 data = req; 172 data = req;
173 } 173 }
174 174
175 aead_request_set_callback(subreq, areq->base.flags, complete, data); 175 aead_request_set_callback(subreq, areq->base.flags, compl, data);
176 aead_request_set_crypt(subreq, areq->src, areq->dst, areq->cryptlen, 176 aead_request_set_crypt(subreq, areq->src, areq->dst, areq->cryptlen,
177 info); 177 info);
178 aead_request_set_assoc(subreq, areq->assoc, areq->assoclen); 178 aead_request_set_assoc(subreq, areq->assoc, areq->assoclen);
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index c48d07857a2b..890449e6e7ef 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -73,13 +73,13 @@ static char *check[] = {
73}; 73};
74 74
75static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc, 75static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc,
76 struct scatterlist *sg, int blen, int sec) 76 struct scatterlist *sg, int blen, int secs)
77{ 77{
78 unsigned long start, end; 78 unsigned long start, end;
79 int bcount; 79 int bcount;
80 int ret; 80 int ret;
81 81
82 for (start = jiffies, end = start + sec * HZ, bcount = 0; 82 for (start = jiffies, end = start + secs * HZ, bcount = 0;
83 time_before(jiffies, end); bcount++) { 83 time_before(jiffies, end); bcount++) {
84 if (enc) 84 if (enc)
85 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); 85 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
@@ -91,7 +91,7 @@ static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc,
91 } 91 }
92 92
93 printk("%d operations in %d seconds (%ld bytes)\n", 93 printk("%d operations in %d seconds (%ld bytes)\n",
94 bcount, sec, (long)bcount * blen); 94 bcount, secs, (long)bcount * blen);
95 return 0; 95 return 0;
96} 96}
97 97
@@ -143,13 +143,13 @@ out:
143} 143}
144 144
145static int test_aead_jiffies(struct aead_request *req, int enc, 145static int test_aead_jiffies(struct aead_request *req, int enc,
146 int blen, int sec) 146 int blen, int secs)
147{ 147{
148 unsigned long start, end; 148 unsigned long start, end;
149 int bcount; 149 int bcount;
150 int ret; 150 int ret;
151 151
152 for (start = jiffies, end = start + sec * HZ, bcount = 0; 152 for (start = jiffies, end = start + secs * HZ, bcount = 0;
153 time_before(jiffies, end); bcount++) { 153 time_before(jiffies, end); bcount++) {
154 if (enc) 154 if (enc)
155 ret = crypto_aead_encrypt(req); 155 ret = crypto_aead_encrypt(req);
@@ -161,7 +161,7 @@ static int test_aead_jiffies(struct aead_request *req, int enc,
161 } 161 }
162 162
163 printk("%d operations in %d seconds (%ld bytes)\n", 163 printk("%d operations in %d seconds (%ld bytes)\n",
164 bcount, sec, (long)bcount * blen); 164 bcount, secs, (long)bcount * blen);
165 return 0; 165 return 0;
166} 166}
167 167
@@ -265,7 +265,7 @@ static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
265 } 265 }
266} 266}
267 267
268static void test_aead_speed(const char *algo, int enc, unsigned int sec, 268static void test_aead_speed(const char *algo, int enc, unsigned int secs,
269 struct aead_speed_template *template, 269 struct aead_speed_template *template,
270 unsigned int tcount, u8 authsize, 270 unsigned int tcount, u8 authsize,
271 unsigned int aad_size, u8 *keysize) 271 unsigned int aad_size, u8 *keysize)
@@ -379,8 +379,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
379 aead_request_set_crypt(req, sg, sgout, *b_size, iv); 379 aead_request_set_crypt(req, sg, sgout, *b_size, iv);
380 aead_request_set_assoc(req, asg, aad_size); 380 aead_request_set_assoc(req, asg, aad_size);
381 381
382 if (sec) 382 if (secs)
383 ret = test_aead_jiffies(req, enc, *b_size, sec); 383 ret = test_aead_jiffies(req, enc, *b_size,
384 secs);
384 else 385 else
385 ret = test_aead_cycles(req, enc, *b_size); 386 ret = test_aead_cycles(req, enc, *b_size);
386 387
@@ -410,7 +411,7 @@ out_noxbuf:
410 return; 411 return;
411} 412}
412 413
413static void test_cipher_speed(const char *algo, int enc, unsigned int sec, 414static void test_cipher_speed(const char *algo, int enc, unsigned int secs,
414 struct cipher_speed_template *template, 415 struct cipher_speed_template *template,
415 unsigned int tcount, u8 *keysize) 416 unsigned int tcount, u8 *keysize)
416{ 417{
@@ -489,9 +490,9 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int sec,
489 crypto_blkcipher_set_iv(tfm, iv, iv_len); 490 crypto_blkcipher_set_iv(tfm, iv, iv_len);
490 } 491 }
491 492
492 if (sec) 493 if (secs)
493 ret = test_cipher_jiffies(&desc, enc, sg, 494 ret = test_cipher_jiffies(&desc, enc, sg,
494 *b_size, sec); 495 *b_size, secs);
495 else 496 else
496 ret = test_cipher_cycles(&desc, enc, sg, 497 ret = test_cipher_cycles(&desc, enc, sg,
497 *b_size); 498 *b_size);
@@ -512,13 +513,13 @@ out:
512 513
513static int test_hash_jiffies_digest(struct hash_desc *desc, 514static int test_hash_jiffies_digest(struct hash_desc *desc,
514 struct scatterlist *sg, int blen, 515 struct scatterlist *sg, int blen,
515 char *out, int sec) 516 char *out, int secs)
516{ 517{
517 unsigned long start, end; 518 unsigned long start, end;
518 int bcount; 519 int bcount;
519 int ret; 520 int ret;
520 521
521 for (start = jiffies, end = start + sec * HZ, bcount = 0; 522 for (start = jiffies, end = start + secs * HZ, bcount = 0;
522 time_before(jiffies, end); bcount++) { 523 time_before(jiffies, end); bcount++) {
523 ret = crypto_hash_digest(desc, sg, blen, out); 524 ret = crypto_hash_digest(desc, sg, blen, out);
524 if (ret) 525 if (ret)
@@ -526,22 +527,22 @@ static int test_hash_jiffies_digest(struct hash_desc *desc,
526 } 527 }
527 528
528 printk("%6u opers/sec, %9lu bytes/sec\n", 529 printk("%6u opers/sec, %9lu bytes/sec\n",
529 bcount / sec, ((long)bcount * blen) / sec); 530 bcount / secs, ((long)bcount * blen) / secs);
530 531
531 return 0; 532 return 0;
532} 533}
533 534
534static int test_hash_jiffies(struct hash_desc *desc, struct scatterlist *sg, 535static int test_hash_jiffies(struct hash_desc *desc, struct scatterlist *sg,
535 int blen, int plen, char *out, int sec) 536 int blen, int plen, char *out, int secs)
536{ 537{
537 unsigned long start, end; 538 unsigned long start, end;
538 int bcount, pcount; 539 int bcount, pcount;
539 int ret; 540 int ret;
540 541
541 if (plen == blen) 542 if (plen == blen)
542 return test_hash_jiffies_digest(desc, sg, blen, out, sec); 543 return test_hash_jiffies_digest(desc, sg, blen, out, secs);
543 544
544 for (start = jiffies, end = start + sec * HZ, bcount = 0; 545 for (start = jiffies, end = start + secs * HZ, bcount = 0;
545 time_before(jiffies, end); bcount++) { 546 time_before(jiffies, end); bcount++) {
546 ret = crypto_hash_init(desc); 547 ret = crypto_hash_init(desc);
547 if (ret) 548 if (ret)
@@ -558,7 +559,7 @@ static int test_hash_jiffies(struct hash_desc *desc, struct scatterlist *sg,
558 } 559 }
559 560
560 printk("%6u opers/sec, %9lu bytes/sec\n", 561 printk("%6u opers/sec, %9lu bytes/sec\n",
561 bcount / sec, ((long)bcount * blen) / sec); 562 bcount / secs, ((long)bcount * blen) / secs);
562 563
563 return 0; 564 return 0;
564} 565}
@@ -679,7 +680,7 @@ static void test_hash_sg_init(struct scatterlist *sg)
679 } 680 }
680} 681}
681 682
682static void test_hash_speed(const char *algo, unsigned int sec, 683static void test_hash_speed(const char *algo, unsigned int secs,
683 struct hash_speed *speed) 684 struct hash_speed *speed)
684{ 685{
685 struct scatterlist sg[TVMEMSIZE]; 686 struct scatterlist sg[TVMEMSIZE];
@@ -725,9 +726,9 @@ static void test_hash_speed(const char *algo, unsigned int sec,
725 "(%5u byte blocks,%5u bytes per update,%4u updates): ", 726 "(%5u byte blocks,%5u bytes per update,%4u updates): ",
726 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); 727 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
727 728
728 if (sec) 729 if (secs)
729 ret = test_hash_jiffies(&desc, sg, speed[i].blen, 730 ret = test_hash_jiffies(&desc, sg, speed[i].blen,
730 speed[i].plen, output, sec); 731 speed[i].plen, output, secs);
731 else 732 else
732 ret = test_hash_cycles(&desc, sg, speed[i].blen, 733 ret = test_hash_cycles(&desc, sg, speed[i].blen,
733 speed[i].plen, output); 734 speed[i].plen, output);
@@ -772,13 +773,13 @@ static inline int do_one_ahash_op(struct ahash_request *req, int ret)
772} 773}
773 774
774static int test_ahash_jiffies_digest(struct ahash_request *req, int blen, 775static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
775 char *out, int sec) 776 char *out, int secs)
776{ 777{
777 unsigned long start, end; 778 unsigned long start, end;
778 int bcount; 779 int bcount;
779 int ret; 780 int ret;
780 781
781 for (start = jiffies, end = start + sec * HZ, bcount = 0; 782 for (start = jiffies, end = start + secs * HZ, bcount = 0;
782 time_before(jiffies, end); bcount++) { 783 time_before(jiffies, end); bcount++) {
783 ret = do_one_ahash_op(req, crypto_ahash_digest(req)); 784 ret = do_one_ahash_op(req, crypto_ahash_digest(req));
784 if (ret) 785 if (ret)
@@ -786,22 +787,22 @@ static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
786 } 787 }
787 788
788 printk("%6u opers/sec, %9lu bytes/sec\n", 789 printk("%6u opers/sec, %9lu bytes/sec\n",
789 bcount / sec, ((long)bcount * blen) / sec); 790 bcount / secs, ((long)bcount * blen) / secs);
790 791
791 return 0; 792 return 0;
792} 793}
793 794
794static int test_ahash_jiffies(struct ahash_request *req, int blen, 795static int test_ahash_jiffies(struct ahash_request *req, int blen,
795 int plen, char *out, int sec) 796 int plen, char *out, int secs)
796{ 797{
797 unsigned long start, end; 798 unsigned long start, end;
798 int bcount, pcount; 799 int bcount, pcount;
799 int ret; 800 int ret;
800 801
801 if (plen == blen) 802 if (plen == blen)
802 return test_ahash_jiffies_digest(req, blen, out, sec); 803 return test_ahash_jiffies_digest(req, blen, out, secs);
803 804
804 for (start = jiffies, end = start + sec * HZ, bcount = 0; 805 for (start = jiffies, end = start + secs * HZ, bcount = 0;
805 time_before(jiffies, end); bcount++) { 806 time_before(jiffies, end); bcount++) {
806 ret = crypto_ahash_init(req); 807 ret = crypto_ahash_init(req);
807 if (ret) 808 if (ret)
@@ -818,7 +819,7 @@ static int test_ahash_jiffies(struct ahash_request *req, int blen,
818 } 819 }
819 820
820 pr_cont("%6u opers/sec, %9lu bytes/sec\n", 821 pr_cont("%6u opers/sec, %9lu bytes/sec\n",
821 bcount / sec, ((long)bcount * blen) / sec); 822 bcount / secs, ((long)bcount * blen) / secs);
822 823
823 return 0; 824 return 0;
824} 825}
@@ -918,7 +919,7 @@ out:
918 return 0; 919 return 0;
919} 920}
920 921
921static void test_ahash_speed(const char *algo, unsigned int sec, 922static void test_ahash_speed(const char *algo, unsigned int secs,
922 struct hash_speed *speed) 923 struct hash_speed *speed)
923{ 924{
924 struct scatterlist sg[TVMEMSIZE]; 925 struct scatterlist sg[TVMEMSIZE];
@@ -968,9 +969,9 @@ static void test_ahash_speed(const char *algo, unsigned int sec,
968 969
969 ahash_request_set_crypt(req, sg, output, speed[i].plen); 970 ahash_request_set_crypt(req, sg, output, speed[i].plen);
970 971
971 if (sec) 972 if (secs)
972 ret = test_ahash_jiffies(req, speed[i].blen, 973 ret = test_ahash_jiffies(req, speed[i].blen,
973 speed[i].plen, output, sec); 974 speed[i].plen, output, secs);
974 else 975 else
975 ret = test_ahash_cycles(req, speed[i].blen, 976 ret = test_ahash_cycles(req, speed[i].blen,
976 speed[i].plen, output); 977 speed[i].plen, output);
@@ -1002,13 +1003,13 @@ static inline int do_one_acipher_op(struct ablkcipher_request *req, int ret)
1002} 1003}
1003 1004
1004static int test_acipher_jiffies(struct ablkcipher_request *req, int enc, 1005static int test_acipher_jiffies(struct ablkcipher_request *req, int enc,
1005 int blen, int sec) 1006 int blen, int secs)
1006{ 1007{
1007 unsigned long start, end; 1008 unsigned long start, end;
1008 int bcount; 1009 int bcount;
1009 int ret; 1010 int ret;
1010 1011
1011 for (start = jiffies, end = start + sec * HZ, bcount = 0; 1012 for (start = jiffies, end = start + secs * HZ, bcount = 0;
1012 time_before(jiffies, end); bcount++) { 1013 time_before(jiffies, end); bcount++) {
1013 if (enc) 1014 if (enc)
1014 ret = do_one_acipher_op(req, 1015 ret = do_one_acipher_op(req,
@@ -1022,7 +1023,7 @@ static int test_acipher_jiffies(struct ablkcipher_request *req, int enc,
1022 } 1023 }
1023 1024
1024 pr_cont("%d operations in %d seconds (%ld bytes)\n", 1025 pr_cont("%d operations in %d seconds (%ld bytes)\n",
1025 bcount, sec, (long)bcount * blen); 1026 bcount, secs, (long)bcount * blen);
1026 return 0; 1027 return 0;
1027} 1028}
1028 1029
@@ -1073,7 +1074,7 @@ out:
1073 return ret; 1074 return ret;
1074} 1075}
1075 1076
1076static void test_acipher_speed(const char *algo, int enc, unsigned int sec, 1077static void test_acipher_speed(const char *algo, int enc, unsigned int secs,
1077 struct cipher_speed_template *template, 1078 struct cipher_speed_template *template,
1078 unsigned int tcount, u8 *keysize) 1079 unsigned int tcount, u8 *keysize)
1079{ 1080{
@@ -1177,9 +1178,9 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
1177 1178
1178 ablkcipher_request_set_crypt(req, sg, sg, *b_size, iv); 1179 ablkcipher_request_set_crypt(req, sg, sg, *b_size, iv);
1179 1180
1180 if (sec) 1181 if (secs)
1181 ret = test_acipher_jiffies(req, enc, 1182 ret = test_acipher_jiffies(req, enc,
1182 *b_size, sec); 1183 *b_size, secs);
1183 else 1184 else
1184 ret = test_acipher_cycles(req, enc, 1185 ret = test_acipher_cycles(req, enc,
1185 *b_size); 1186 *b_size);