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>
This commit is contained in:
Luca Clementi 2014-06-25 22:57:42 -07:00 коммит произвёл Herbert Xu
Родитель 14748d7c56
Коммит 263a8df0d3
1 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -47,6 +47,11 @@
#define ENCRYPT 1 #define ENCRYPT 1
#define DECRYPT 0 #define DECRYPT 0
/*
* return a string with the driver name
*/
#define get_driver_name(tfm_type, tfm) crypto_tfm_alg_driver_name(tfm_type ## _tfm(tfm))
/* /*
* Used by test_cipher_speed() * Used by test_cipher_speed()
*/ */
@ -305,9 +310,6 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
asg = &sg[8]; asg = &sg[8];
sgout = &asg[8]; sgout = &asg[8];
printk(KERN_INFO "\ntesting speed of %s %s\n", algo, e);
tfm = crypto_alloc_aead(algo, 0, 0); tfm = crypto_alloc_aead(algo, 0, 0);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
@ -316,6 +318,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
goto out_notfm; goto out_notfm;
} }
printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo,
get_driver_name(crypto_aead, tfm), e);
req = aead_request_alloc(tfm, GFP_KERNEL); req = aead_request_alloc(tfm, GFP_KERNEL);
if (!req) { if (!req) {
pr_err("alg: aead: Failed to allocate request for %s\n", 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,
else else
e = "decryption"; e = "decryption";
printk("\ntesting speed of %s %s\n", algo, e);
tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC); tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
@ -434,6 +437,9 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int sec,
desc.tfm = tfm; desc.tfm = tfm;
desc.flags = 0; desc.flags = 0;
printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo,
get_driver_name(crypto_blkcipher, tfm), e);
i = 0; i = 0;
do { do {
@ -683,8 +689,6 @@ static void test_hash_speed(const char *algo, unsigned int sec,
int i; int i;
int ret; int ret;
printk(KERN_INFO "\ntesting speed of %s\n", algo);
tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
@ -693,6 +697,9 @@ static void test_hash_speed(const char *algo, unsigned int sec,
return; return;
} }
printk(KERN_INFO "\ntesting speed of %s (%s)\n", algo,
get_driver_name(crypto_hash, tfm));
desc.tfm = tfm; desc.tfm = tfm;
desc.flags = 0; desc.flags = 0;
@ -921,8 +928,6 @@ static void test_ahash_speed(const char *algo, unsigned int sec,
static char output[1024]; static char output[1024];
int i, ret; int i, ret;
printk(KERN_INFO "\ntesting speed of async %s\n", algo);
tfm = crypto_alloc_ahash(algo, 0, 0); tfm = crypto_alloc_ahash(algo, 0, 0);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
pr_err("failed to load transform for %s: %ld\n", 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,
return; return;
} }
printk(KERN_INFO "\ntesting speed of async %s (%s)\n", algo,
get_driver_name(crypto_ahash, tfm));
if (crypto_ahash_digestsize(tfm) > sizeof(output)) { if (crypto_ahash_digestsize(tfm) > sizeof(output)) {
pr_err("digestsize(%u) > outputbuffer(%zu)\n", pr_err("digestsize(%u) > outputbuffer(%zu)\n",
crypto_ahash_digestsize(tfm), sizeof(output)); crypto_ahash_digestsize(tfm), sizeof(output));
@ -1083,8 +1091,6 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
else else
e = "decryption"; e = "decryption";
pr_info("\ntesting speed of async %s %s\n", algo, e);
init_completion(&tresult.completion); init_completion(&tresult.completion);
tfm = crypto_alloc_ablkcipher(algo, 0, 0); tfm = crypto_alloc_ablkcipher(algo, 0, 0);
@ -1095,6 +1101,9 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
return; return;
} }
pr_info("\ntesting speed of async %s (%s) %s\n", algo,
get_driver_name(crypto_ablkcipher, tfm), e);
req = ablkcipher_request_alloc(tfm, GFP_KERNEL); req = ablkcipher_request_alloc(tfm, GFP_KERNEL);
if (!req) { if (!req) {
pr_err("tcrypt: skcipher: Failed to allocate request for %s\n", pr_err("tcrypt: skcipher: Failed to allocate request for %s\n",