diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/tcrypt.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 164ec0e16756..c48d07857a2b 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -48,6 +48,11 @@ | |||
48 | #define DECRYPT 0 | 48 | #define DECRYPT 0 |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * return a string with the driver name | ||
52 | */ | ||
53 | #define get_driver_name(tfm_type, tfm) crypto_tfm_alg_driver_name(tfm_type ## _tfm(tfm)) | ||
54 | |||
55 | /* | ||
51 | * Used by test_cipher_speed() | 56 | * Used by test_cipher_speed() |
52 | */ | 57 | */ |
53 | static unsigned int sec; | 58 | static unsigned int sec; |
@@ -305,9 +310,6 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec, | |||
305 | asg = &sg[8]; | 310 | asg = &sg[8]; |
306 | sgout = &asg[8]; | 311 | sgout = &asg[8]; |
307 | 312 | ||
308 | |||
309 | printk(KERN_INFO "\ntesting speed of %s %s\n", algo, e); | ||
310 | |||
311 | tfm = crypto_alloc_aead(algo, 0, 0); | 313 | tfm = crypto_alloc_aead(algo, 0, 0); |
312 | 314 | ||
313 | if (IS_ERR(tfm)) { | 315 | if (IS_ERR(tfm)) { |
@@ -316,6 +318,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec, | |||
316 | goto out_notfm; | 318 | goto out_notfm; |
317 | } | 319 | } |
318 | 320 | ||
321 | printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo, | ||
322 | get_driver_name(crypto_aead, tfm), e); | ||
323 | |||
319 | req = aead_request_alloc(tfm, GFP_KERNEL); | 324 | req = aead_request_alloc(tfm, GFP_KERNEL); |
320 | if (!req) { | 325 | if (!req) { |
321 | pr_err("alg: aead: Failed to allocate request for %s\n", | 326 | pr_err("alg: aead: Failed to allocate request for %s\n", |
@@ -422,8 +427,6 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int sec, | |||
422 | else | 427 | else |
423 | e = "decryption"; | 428 | e = "decryption"; |
424 | 429 | ||
425 | printk("\ntesting speed of %s %s\n", algo, e); | ||
426 | |||
427 | tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC); | 430 | tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC); |
428 | 431 | ||
429 | if (IS_ERR(tfm)) { | 432 | if (IS_ERR(tfm)) { |
@@ -434,6 +437,9 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int sec, | |||
434 | desc.tfm = tfm; | 437 | desc.tfm = tfm; |
435 | desc.flags = 0; | 438 | desc.flags = 0; |
436 | 439 | ||
440 | printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo, | ||
441 | get_driver_name(crypto_blkcipher, tfm), e); | ||
442 | |||
437 | i = 0; | 443 | i = 0; |
438 | do { | 444 | do { |
439 | 445 | ||
@@ -683,8 +689,6 @@ static void test_hash_speed(const char *algo, unsigned int sec, | |||
683 | int i; | 689 | int i; |
684 | int ret; | 690 | int ret; |
685 | 691 | ||
686 | printk(KERN_INFO "\ntesting speed of %s\n", algo); | ||
687 | |||
688 | tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); | 692 | tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); |
689 | 693 | ||
690 | if (IS_ERR(tfm)) { | 694 | if (IS_ERR(tfm)) { |
@@ -693,6 +697,9 @@ static void test_hash_speed(const char *algo, unsigned int sec, | |||
693 | return; | 697 | return; |
694 | } | 698 | } |
695 | 699 | ||
700 | printk(KERN_INFO "\ntesting speed of %s (%s)\n", algo, | ||
701 | get_driver_name(crypto_hash, tfm)); | ||
702 | |||
696 | desc.tfm = tfm; | 703 | desc.tfm = tfm; |
697 | desc.flags = 0; | 704 | desc.flags = 0; |
698 | 705 | ||
@@ -921,8 +928,6 @@ static void test_ahash_speed(const char *algo, unsigned int sec, | |||
921 | static char output[1024]; | 928 | static char output[1024]; |
922 | int i, ret; | 929 | int i, ret; |
923 | 930 | ||
924 | printk(KERN_INFO "\ntesting speed of async %s\n", algo); | ||
925 | |||
926 | tfm = crypto_alloc_ahash(algo, 0, 0); | 931 | tfm = crypto_alloc_ahash(algo, 0, 0); |
927 | if (IS_ERR(tfm)) { | 932 | if (IS_ERR(tfm)) { |
928 | pr_err("failed to load transform for %s: %ld\n", | 933 | pr_err("failed to load transform for %s: %ld\n", |
@@ -930,6 +935,9 @@ static void test_ahash_speed(const char *algo, unsigned int sec, | |||
930 | return; | 935 | return; |
931 | } | 936 | } |
932 | 937 | ||
938 | printk(KERN_INFO "\ntesting speed of async %s (%s)\n", algo, | ||
939 | get_driver_name(crypto_ahash, tfm)); | ||
940 | |||
933 | if (crypto_ahash_digestsize(tfm) > sizeof(output)) { | 941 | if (crypto_ahash_digestsize(tfm) > sizeof(output)) { |
934 | pr_err("digestsize(%u) > outputbuffer(%zu)\n", | 942 | pr_err("digestsize(%u) > outputbuffer(%zu)\n", |
935 | crypto_ahash_digestsize(tfm), sizeof(output)); | 943 | crypto_ahash_digestsize(tfm), sizeof(output)); |
@@ -1083,8 +1091,6 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec, | |||
1083 | else | 1091 | else |
1084 | e = "decryption"; | 1092 | e = "decryption"; |
1085 | 1093 | ||
1086 | pr_info("\ntesting speed of async %s %s\n", algo, e); | ||
1087 | |||
1088 | init_completion(&tresult.completion); | 1094 | init_completion(&tresult.completion); |
1089 | 1095 | ||
1090 | tfm = crypto_alloc_ablkcipher(algo, 0, 0); | 1096 | tfm = crypto_alloc_ablkcipher(algo, 0, 0); |
@@ -1095,6 +1101,9 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec, | |||
1095 | return; | 1101 | return; |
1096 | } | 1102 | } |
1097 | 1103 | ||
1104 | pr_info("\ntesting speed of async %s (%s) %s\n", algo, | ||
1105 | get_driver_name(crypto_ablkcipher, tfm), e); | ||
1106 | |||
1098 | req = ablkcipher_request_alloc(tfm, GFP_KERNEL); | 1107 | req = ablkcipher_request_alloc(tfm, GFP_KERNEL); |
1099 | if (!req) { | 1108 | if (!req) { |
1100 | pr_err("tcrypt: skcipher: Failed to allocate request for %s\n", | 1109 | pr_err("tcrypt: skcipher: Failed to allocate request for %s\n", |