[PATCH] crypto: DRBG return code handling inside testmgr.c

From: Alexander Bergmann
Date: Tue Mar 10 2015 - 11:16:31 EST


Hi Herbert,

I just fixed a small DRBG return code issue inside testmgr.c directly
related to the RNG changes Stephan submitted.


Regards,
Alex

--
Alexander Bergmann <abergmann@xxxxxxxx>, Security Engineer,
SUSE Linux GmbH,
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton, HRB 21284 (AG Nürnberg)
From 4348e8ae9361284c9bdd591a4e5988d575daa736 Mon Sep 17 00:00:00 2001
From: Alexander Bergmann <abergmann@xxxxxxxx>
Date: Tue, 10 Mar 2015 16:05:22 +0100
Subject: [PATCH] crypto: DRBG return code handling inside testmgr.c

This is a follow-up fix for the "RNGs must return 0 in success case"
changes. The drbg_cavs_test function has to handle the DRBG return codes
correctly as 0 is not an error anymore.

Signed-off-by: Alexander Bergmann <abergmann@xxxxxxxx>
---
crypto/testmgr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index f4ed6d4..01b6967 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1759,7 +1759,7 @@ static int drbg_cavs_test(struct drbg_testvec *test, int pr,
ret = crypto_drbg_get_bytes_addtl(drng,
buf, test->expectedlen, &addtl);
}
- if (ret <= 0) {
+ if (ret < 0) {
printk(KERN_ERR "alg: drbg: could not obtain random data for "
"driver %s\n", driver);
goto outbuf;
@@ -1774,7 +1774,7 @@ static int drbg_cavs_test(struct drbg_testvec *test, int pr,
ret = crypto_drbg_get_bytes_addtl(drng,
buf, test->expectedlen, &addtl);
}
- if (ret <= 0) {
+ if (ret < 0) {
printk(KERN_ERR "alg: drbg: could not obtain random data for "
"driver %s\n", driver);
goto outbuf;
--
1.8.1.4

Attachment: signature.asc
Description: Digital signature