Skip to content

Commit 4eded6d

Browse files
committed
crypto: testmgr - Hide ENOENT errors
When a crypto algorithm with a higher priority is registered, it kills the spawns of all lower-priority algorithms. Thus it is to be expected for an algorithm to go away at any time, even during a self-test. This is now much more common with asynchronous testing. Remove the printk when an ENOENT is encountered during a self-test. This is not really an error since the algorithm being tested is no longer there (i.e., it didn't fail the test which is what we care about). Signed-off-by: Herbert Xu <[email protected]>
1 parent 2e691e1 commit 4eded6d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

crypto/testmgr.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,8 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
19391939

19401940
atfm = crypto_alloc_ahash(driver, type, mask);
19411941
if (IS_ERR(atfm)) {
1942+
if (PTR_ERR(atfm) == -ENOENT)
1943+
return -ENOENT;
19421944
pr_err("alg: hash: failed to allocate transform for %s: %ld\n",
19431945
driver, PTR_ERR(atfm));
19441946
return PTR_ERR(atfm);
@@ -2703,6 +2705,8 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver,
27032705

27042706
tfm = crypto_alloc_aead(driver, type, mask);
27052707
if (IS_ERR(tfm)) {
2708+
if (PTR_ERR(tfm) == -ENOENT)
2709+
return -ENOENT;
27062710
pr_err("alg: aead: failed to allocate transform for %s: %ld\n",
27072711
driver, PTR_ERR(tfm));
27082712
return PTR_ERR(tfm);
@@ -3280,6 +3284,8 @@ static int alg_test_skcipher(const struct alg_test_desc *desc,
32803284

32813285
tfm = crypto_alloc_skcipher(driver, type, mask);
32823286
if (IS_ERR(tfm)) {
3287+
if (PTR_ERR(tfm) == -ENOENT)
3288+
return -ENOENT;
32833289
pr_err("alg: skcipher: failed to allocate transform for %s: %ld\n",
32843290
driver, PTR_ERR(tfm));
32853291
return PTR_ERR(tfm);
@@ -3693,6 +3699,8 @@ static int alg_test_cipher(const struct alg_test_desc *desc,
36933699

36943700
tfm = crypto_alloc_cipher(driver, type, mask);
36953701
if (IS_ERR(tfm)) {
3702+
if (PTR_ERR(tfm) == -ENOENT)
3703+
return -ENOENT;
36963704
printk(KERN_ERR "alg: cipher: Failed to load transform for "
36973705
"%s: %ld\n", driver, PTR_ERR(tfm));
36983706
return PTR_ERR(tfm);
@@ -3717,6 +3725,8 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
37173725
if (algo_type == CRYPTO_ALG_TYPE_ACOMPRESS) {
37183726
acomp = crypto_alloc_acomp(driver, type, mask);
37193727
if (IS_ERR(acomp)) {
3728+
if (PTR_ERR(acomp) == -ENOENT)
3729+
return -ENOENT;
37203730
pr_err("alg: acomp: Failed to load transform for %s: %ld\n",
37213731
driver, PTR_ERR(acomp));
37223732
return PTR_ERR(acomp);
@@ -3729,6 +3739,8 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
37293739
} else {
37303740
comp = crypto_alloc_comp(driver, type, mask);
37313741
if (IS_ERR(comp)) {
3742+
if (PTR_ERR(comp) == -ENOENT)
3743+
return -ENOENT;
37323744
pr_err("alg: comp: Failed to load transform for %s: %ld\n",
37333745
driver, PTR_ERR(comp));
37343746
return PTR_ERR(comp);
@@ -3805,6 +3817,8 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
38053817

38063818
rng = crypto_alloc_rng(driver, type, mask);
38073819
if (IS_ERR(rng)) {
3820+
if (PTR_ERR(rng) == -ENOENT)
3821+
return -ENOENT;
38083822
printk(KERN_ERR "alg: cprng: Failed to load transform for %s: "
38093823
"%ld\n", driver, PTR_ERR(rng));
38103824
return PTR_ERR(rng);
@@ -3832,10 +3846,13 @@ static int drbg_cavs_test(const struct drbg_testvec *test, int pr,
38323846

38333847
drng = crypto_alloc_rng(driver, type, mask);
38343848
if (IS_ERR(drng)) {
3849+
if (PTR_ERR(drng) == -ENOENT)
3850+
goto out_no_rng;
38353851
printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for "
38363852
"%s\n", driver);
3853+
out_no_rng:
38373854
kfree_sensitive(buf);
3838-
return -ENOMEM;
3855+
return PTR_ERR(drng);
38393856
}
38403857

38413858
test_data.testentropy = &testentropy;
@@ -4077,6 +4094,8 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver,
40774094

40784095
tfm = crypto_alloc_kpp(driver, type, mask);
40794096
if (IS_ERR(tfm)) {
4097+
if (PTR_ERR(tfm) == -ENOENT)
4098+
return -ENOENT;
40804099
pr_err("alg: kpp: Failed to load tfm for %s: %ld\n",
40814100
driver, PTR_ERR(tfm));
40824101
return PTR_ERR(tfm);
@@ -4305,6 +4324,8 @@ static int alg_test_akcipher(const struct alg_test_desc *desc,
43054324

43064325
tfm = crypto_alloc_akcipher(driver, type, mask);
43074326
if (IS_ERR(tfm)) {
4327+
if (PTR_ERR(tfm) == -ENOENT)
4328+
return -ENOENT;
43084329
pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n",
43094330
driver, PTR_ERR(tfm));
43104331
return PTR_ERR(tfm);

0 commit comments

Comments
 (0)