mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
crypto: testmgr - Hide ENOENT errors better
The previous patch removed the ENOENT warning at the point of
allocation, but the overall self-test warning is still there.
Fix all of them by returning zero as the test result. This is
safe because if the algorithm has gone away, then it cannot be
marked as tested.
Fixes: 4eded6d14f
("crypto: testmgr - Hide ENOENT errors")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
b81e286ba1
commit
6318fbe26e
@ -1940,7 +1940,7 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
|
|||||||
atfm = crypto_alloc_ahash(driver, type, mask);
|
atfm = crypto_alloc_ahash(driver, type, mask);
|
||||||
if (IS_ERR(atfm)) {
|
if (IS_ERR(atfm)) {
|
||||||
if (PTR_ERR(atfm) == -ENOENT)
|
if (PTR_ERR(atfm) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: hash: failed to allocate transform for %s: %ld\n",
|
pr_err("alg: hash: failed to allocate transform for %s: %ld\n",
|
||||||
driver, PTR_ERR(atfm));
|
driver, PTR_ERR(atfm));
|
||||||
return PTR_ERR(atfm);
|
return PTR_ERR(atfm);
|
||||||
@ -2706,7 +2706,7 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver,
|
|||||||
tfm = crypto_alloc_aead(driver, type, mask);
|
tfm = crypto_alloc_aead(driver, type, mask);
|
||||||
if (IS_ERR(tfm)) {
|
if (IS_ERR(tfm)) {
|
||||||
if (PTR_ERR(tfm) == -ENOENT)
|
if (PTR_ERR(tfm) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: aead: failed to allocate transform for %s: %ld\n",
|
pr_err("alg: aead: failed to allocate transform for %s: %ld\n",
|
||||||
driver, PTR_ERR(tfm));
|
driver, PTR_ERR(tfm));
|
||||||
return PTR_ERR(tfm);
|
return PTR_ERR(tfm);
|
||||||
@ -3285,7 +3285,7 @@ static int alg_test_skcipher(const struct alg_test_desc *desc,
|
|||||||
tfm = crypto_alloc_skcipher(driver, type, mask);
|
tfm = crypto_alloc_skcipher(driver, type, mask);
|
||||||
if (IS_ERR(tfm)) {
|
if (IS_ERR(tfm)) {
|
||||||
if (PTR_ERR(tfm) == -ENOENT)
|
if (PTR_ERR(tfm) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: skcipher: failed to allocate transform for %s: %ld\n",
|
pr_err("alg: skcipher: failed to allocate transform for %s: %ld\n",
|
||||||
driver, PTR_ERR(tfm));
|
driver, PTR_ERR(tfm));
|
||||||
return PTR_ERR(tfm);
|
return PTR_ERR(tfm);
|
||||||
@ -3700,7 +3700,7 @@ static int alg_test_cipher(const struct alg_test_desc *desc,
|
|||||||
tfm = crypto_alloc_cipher(driver, type, mask);
|
tfm = crypto_alloc_cipher(driver, type, mask);
|
||||||
if (IS_ERR(tfm)) {
|
if (IS_ERR(tfm)) {
|
||||||
if (PTR_ERR(tfm) == -ENOENT)
|
if (PTR_ERR(tfm) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
printk(KERN_ERR "alg: cipher: Failed to load transform for "
|
printk(KERN_ERR "alg: cipher: Failed to load transform for "
|
||||||
"%s: %ld\n", driver, PTR_ERR(tfm));
|
"%s: %ld\n", driver, PTR_ERR(tfm));
|
||||||
return PTR_ERR(tfm);
|
return PTR_ERR(tfm);
|
||||||
@ -3726,7 +3726,7 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
|
|||||||
acomp = crypto_alloc_acomp(driver, type, mask);
|
acomp = crypto_alloc_acomp(driver, type, mask);
|
||||||
if (IS_ERR(acomp)) {
|
if (IS_ERR(acomp)) {
|
||||||
if (PTR_ERR(acomp) == -ENOENT)
|
if (PTR_ERR(acomp) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: acomp: Failed to load transform for %s: %ld\n",
|
pr_err("alg: acomp: Failed to load transform for %s: %ld\n",
|
||||||
driver, PTR_ERR(acomp));
|
driver, PTR_ERR(acomp));
|
||||||
return PTR_ERR(acomp);
|
return PTR_ERR(acomp);
|
||||||
@ -3740,7 +3740,7 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
|
|||||||
comp = crypto_alloc_comp(driver, type, mask);
|
comp = crypto_alloc_comp(driver, type, mask);
|
||||||
if (IS_ERR(comp)) {
|
if (IS_ERR(comp)) {
|
||||||
if (PTR_ERR(comp) == -ENOENT)
|
if (PTR_ERR(comp) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: comp: Failed to load transform for %s: %ld\n",
|
pr_err("alg: comp: Failed to load transform for %s: %ld\n",
|
||||||
driver, PTR_ERR(comp));
|
driver, PTR_ERR(comp));
|
||||||
return PTR_ERR(comp);
|
return PTR_ERR(comp);
|
||||||
@ -3818,7 +3818,7 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
|
|||||||
rng = crypto_alloc_rng(driver, type, mask);
|
rng = crypto_alloc_rng(driver, type, mask);
|
||||||
if (IS_ERR(rng)) {
|
if (IS_ERR(rng)) {
|
||||||
if (PTR_ERR(rng) == -ENOENT)
|
if (PTR_ERR(rng) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
printk(KERN_ERR "alg: cprng: Failed to load transform for %s: "
|
printk(KERN_ERR "alg: cprng: Failed to load transform for %s: "
|
||||||
"%ld\n", driver, PTR_ERR(rng));
|
"%ld\n", driver, PTR_ERR(rng));
|
||||||
return PTR_ERR(rng);
|
return PTR_ERR(rng);
|
||||||
@ -3846,12 +3846,11 @@ static int drbg_cavs_test(const struct drbg_testvec *test, int pr,
|
|||||||
|
|
||||||
drng = crypto_alloc_rng(driver, type, mask);
|
drng = crypto_alloc_rng(driver, type, mask);
|
||||||
if (IS_ERR(drng)) {
|
if (IS_ERR(drng)) {
|
||||||
|
kfree_sensitive(buf);
|
||||||
if (PTR_ERR(drng) == -ENOENT)
|
if (PTR_ERR(drng) == -ENOENT)
|
||||||
goto out_no_rng;
|
return 0;
|
||||||
printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for "
|
printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for "
|
||||||
"%s\n", driver);
|
"%s\n", driver);
|
||||||
out_no_rng:
|
|
||||||
kfree_sensitive(buf);
|
|
||||||
return PTR_ERR(drng);
|
return PTR_ERR(drng);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4095,7 +4094,7 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver,
|
|||||||
tfm = crypto_alloc_kpp(driver, type, mask);
|
tfm = crypto_alloc_kpp(driver, type, mask);
|
||||||
if (IS_ERR(tfm)) {
|
if (IS_ERR(tfm)) {
|
||||||
if (PTR_ERR(tfm) == -ENOENT)
|
if (PTR_ERR(tfm) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: kpp: Failed to load tfm for %s: %ld\n",
|
pr_err("alg: kpp: Failed to load tfm for %s: %ld\n",
|
||||||
driver, PTR_ERR(tfm));
|
driver, PTR_ERR(tfm));
|
||||||
return PTR_ERR(tfm);
|
return PTR_ERR(tfm);
|
||||||
@ -4325,7 +4324,7 @@ static int alg_test_akcipher(const struct alg_test_desc *desc,
|
|||||||
tfm = crypto_alloc_akcipher(driver, type, mask);
|
tfm = crypto_alloc_akcipher(driver, type, mask);
|
||||||
if (IS_ERR(tfm)) {
|
if (IS_ERR(tfm)) {
|
||||||
if (PTR_ERR(tfm) == -ENOENT)
|
if (PTR_ERR(tfm) == -ENOENT)
|
||||||
return -ENOENT;
|
return 0;
|
||||||
pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n",
|
pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n",
|
||||||
driver, PTR_ERR(tfm));
|
driver, PTR_ERR(tfm));
|
||||||
return PTR_ERR(tfm);
|
return PTR_ERR(tfm);
|
||||||
|
Loading…
Reference in New Issue
Block a user