Skip to content

Commit 19e60e1

Browse files
smuellerDDherbertx
authored andcommitted
crypto: testmgr - fix RNG return code enforcement
Due to the change to RNGs to always return zero in success case, the invocation of the RNGs in the test manager must be updated as otherwise the RNG self tests are not properly executed any more. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Alexander Bergmann <abergmann@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent f42613c commit 19e60e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crypto/testmgr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,11 +1474,11 @@ static int test_cprng(struct crypto_rng *tfm, struct cprng_testvec *template,
14741474
for (j = 0; j < template[i].loops; j++) {
14751475
err = crypto_rng_get_bytes(tfm, result,
14761476
template[i].rlen);
1477-
if (err != template[i].rlen) {
1477+
if (err < 0) {
14781478
printk(KERN_ERR "alg: cprng: Failed to obtain "
14791479
"the correct amount of random data for "
1480-
"%s (requested %d, got %d)\n", algo,
1481-
template[i].rlen, err);
1480+
"%s (requested %d)\n", algo,
1481+
template[i].rlen);
14821482
goto out;
14831483
}
14841484
}
@@ -1759,7 +1759,7 @@ static int drbg_cavs_test(struct drbg_testvec *test, int pr,
17591759
ret = crypto_drbg_get_bytes_addtl(drng,
17601760
buf, test->expectedlen, &addtl);
17611761
}
1762-
if (ret <= 0) {
1762+
if (ret < 0) {
17631763
printk(KERN_ERR "alg: drbg: could not obtain random data for "
17641764
"driver %s\n", driver);
17651765
goto outbuf;
@@ -1774,7 +1774,7 @@ static int drbg_cavs_test(struct drbg_testvec *test, int pr,
17741774
ret = crypto_drbg_get_bytes_addtl(drng,
17751775
buf, test->expectedlen, &addtl);
17761776
}
1777-
if (ret <= 0) {
1777+
if (ret < 0) {
17781778
printk(KERN_ERR "alg: drbg: could not obtain random data for "
17791779
"driver %s\n", driver);
17801780
goto outbuf;

0 commit comments

Comments
 (0)