public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: [PATCH 4/8] DRBG: remove superflowous memset(0)
Date: Sun, 17 Aug 2014 17:38:58 +0200	[thread overview]
Message-ID: <10134662.iYyEj4XcbG@myon.chronox.de> (raw)
In-Reply-To: <7044529.FG2KhbPc9P@myon.chronox.de>

Remove memset(0) which is not needed due to the kzalloc of the memory.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
 crypto/drbg.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/crypto/drbg.c b/crypto/drbg.c
index 89d732b..d13f588 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -728,11 +728,9 @@ static int drbg_hmac_update(struct drbg_state *drbg, struct list_head *seed,
 	LIST_HEAD(seedlist);
 	LIST_HEAD(vdatalist);
 
-	if (!reseed) {
-		/* 10.1.2.3 step 2 */
-		memset(drbg->C, 0, drbg_statelen(drbg));
+	if (!reseed)
+		/* 10.1.2.3 step 2 -- memset(0) of C is implicit with kzalloc */
 		memset(drbg->V, 1, drbg_statelen(drbg));
-	}
 
 	drbg_string_fill(&seed1, drbg->V, drbg_statelen(drbg));
 	list_add_tail(&seed1.list, &seedlist);
-- 
1.9.3



  parent reply	other threads:[~2014-08-17 15:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 15:37 [PATCH 0/8] DRBG: efficiency patches Stephan Mueller
2014-08-17 15:37 ` [PATCH 1/8] DRBG: replace int2byte with cpu_to_be Stephan Mueller
2014-08-17 15:37 ` [PATCH 2/8] DRBG: kzfree does not need a check for NULL pointer Stephan Mueller
2014-08-17 15:38 ` [PATCH 3/8] DRBG: remove superflowous checks Stephan Mueller
2014-08-17 15:38 ` Stephan Mueller [this message]
2014-08-17 15:39 ` [PATCH 5/8] DRBG: use kmalloc instead of kzalloc for V and C Stephan Mueller
2014-08-17 15:40 ` [PATCH 6/8] DRBG: remove unnecessary sanity checks Stephan Mueller
2014-08-17 15:41 ` [PATCH 7/8] DRBG: remove configuration of fixed values Stephan Mueller
2014-08-17 15:41 ` [PATCH 8/8] DRBG: remove unnecessary sanity check for shadow state Stephan Mueller
2014-08-25 12:42 ` [PATCH 0/8] DRBG: efficiency patches 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=10134662.iYyEj4XcbG@myon.chronox.de \
    --to=smueller@chronox.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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