public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Bergmann <abergmann@suse.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Stephan Mueller <smueller@chronox.de>, linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: DRBG return code handling inside testmgr.c
Date: Tue, 10 Mar 2015 16:14:17 +0100	[thread overview]
Message-ID: <20150310151417.GU786@surtsey.monkey.lab> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 350 bytes --]

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@suse.com>, Security Engineer,
SUSE Linux GmbH,
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton, HRB 21284 (AG Nürnberg)

[-- Attachment #1.2: 0001-crypto-DRBG-return-code-handling-inside-testmgr.c.patch --]
[-- Type: text/x-patch, Size: 1356 bytes --]

From 4348e8ae9361284c9bdd591a4e5988d575daa736 Mon Sep 17 00:00:00 2001
From: Alexander Bergmann <abergmann@suse.com>
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@suse.com>
---
 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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

             reply	other threads:[~2015-03-10 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 15:14 Alexander Bergmann [this message]
2015-03-10 16:11 ` [PATCH] crypto: DRBG return code handling inside testmgr.c Stephan Mueller
2015-03-10 21:48 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150310151417.GU786@surtsey.monkey.lab \
    --to=abergmann@suse.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smueller@chronox.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox