aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
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/tcrypt.c
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/tcrypt.c')
-rw-r--r--crypto/tcrypt.c77
1 files changed, 39 insertions, 38 deletions
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);