Skip to content

Commit 263a8df

Browse files
lclementiherbertx
authored andcommitted
crypto: tcrypt - print cra driver name in tcrypt tests output
Print the driver name that is being tested. The driver name can be inferred parsing /proc/crypto but having it in the output is clearer Signed-off-by: Luca Clementi <luca.clementi@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 14748d7 commit 263a8df

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

‎crypto/tcrypt.c‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
#define ENCRYPT 1
4848
#define DECRYPT 0
4949

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+
5055
/*
5156
* Used by test_cipher_speed()
5257
*/
@@ -305,9 +310,6 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
305310
asg = &sg[8];
306311
sgout = &asg[8];
307312

308-
309-
printk(KERN_INFO "\ntesting speed of %s %s\n", algo, e);
310-
311313
tfm = crypto_alloc_aead(algo, 0, 0);
312314

313315
if (IS_ERR(tfm)) {
@@ -316,6 +318,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
316318
goto out_notfm;
317319
}
318320

321+
printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo,
322+
get_driver_name(crypto_aead, tfm), e);
323+
319324
req = aead_request_alloc(tfm, GFP_KERNEL);
320325
if (!req) {
321326
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,
422427
else
423428
e = "decryption";
424429

425-
printk("\ntesting speed of %s %s\n", algo, e);
426-
427430
tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC);
428431

429432
if (IS_ERR(tfm)) {
@@ -434,6 +437,9 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int sec,
434437
desc.tfm = tfm;
435438
desc.flags = 0;
436439

440+
printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo,
441+
get_driver_name(crypto_blkcipher, tfm), e);
442+
437443
i = 0;
438444
do {
439445

@@ -683,8 +689,6 @@ static void test_hash_speed(const char *algo, unsigned int sec,
683689
int i;
684690
int ret;
685691

686-
printk(KERN_INFO "\ntesting speed of %s\n", algo);
687-
688692
tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC);
689693

690694
if (IS_ERR(tfm)) {
@@ -693,6 +697,9 @@ static void test_hash_speed(const char *algo, unsigned int sec,
693697
return;
694698
}
695699

700+
printk(KERN_INFO "\ntesting speed of %s (%s)\n", algo,
701+
get_driver_name(crypto_hash, tfm));
702+
696703
desc.tfm = tfm;
697704
desc.flags = 0;
698705

@@ -921,15 +928,16 @@ static void test_ahash_speed(const char *algo, unsigned int sec,
921928
static char output[1024];
922929
int i, ret;
923930

924-
printk(KERN_INFO "\ntesting speed of async %s\n", algo);
925-
926931
tfm = crypto_alloc_ahash(algo, 0, 0);
927932
if (IS_ERR(tfm)) {
928933
pr_err("failed to load transform for %s: %ld\n",
929934
algo, PTR_ERR(tfm));
930935
return;
931936
}
932937

938+
printk(KERN_INFO "\ntesting speed of async %s (%s)\n", algo,
939+
get_driver_name(crypto_ahash, tfm));
940+
933941
if (crypto_ahash_digestsize(tfm) > sizeof(output)) {
934942
pr_err("digestsize(%u) > outputbuffer(%zu)\n",
935943
crypto_ahash_digestsize(tfm), sizeof(output));
@@ -1083,8 +1091,6 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
10831091
else
10841092
e = "decryption";
10851093

1086-
pr_info("\ntesting speed of async %s %s\n", algo, e);
1087-
10881094
init_completion(&tresult.completion);
10891095

10901096
tfm = crypto_alloc_ablkcipher(algo, 0, 0);
@@ -1095,6 +1101,9 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
10951101
return;
10961102
}
10971103

1104+
pr_info("\ntesting speed of async %s (%s) %s\n", algo,
1105+
get_driver_name(crypto_ablkcipher, tfm), e);
1106+
10981107
req = ablkcipher_request_alloc(tfm, GFP_KERNEL);
10991108
if (!req) {
11001109
pr_err("tcrypt: skcipher: Failed to allocate request for %s\n",

0 commit comments

Comments
 (0)