From: Stephan Mueller <smueller@chronox.de>
To: kbuild test robot <fengguang.wu@intel.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: kbuild@01.org, Dan Carpenter <dan.carpenter@oracle.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] Potential NULL pointer deference in drbg_ctr_df
Date: Sat, 21 Jun 2014 14:26:29 +0200 [thread overview]
Message-ID: <4892293.kf6KiPx6BS@myon.chronox.de> (raw)
In-Reply-To: <20140620202418.GZ5015@mwanda>
The handling of additional input data / personalization string data may
be subject to a NULL pointer deference for the CTR DRBG. The
caller-provided data may be NULL which must be caught by the DRBG.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
crypto/drbg.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/crypto/drbg.c b/crypto/drbg.c
index faaa2ce..8e7c302 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -513,17 +513,20 @@ static int drbg_ctr_df(struct drbg_state *drbg,
drbg_string_fill(&S2, L_N, sizeof(L_N));
drbg_string_fill(&S4, pad, padlen);
S1.next = &S2;
- S2.next = addtl;
- /*
- * splice in addtl between S2 and S4 -- we place S4 at the end of the
- * input data chain
- */
- tempstr = addtl;
- for (; NULL != tempstr; tempstr = tempstr->next)
- if (NULL == tempstr->next)
- break;
- tempstr->next = &S4;
+ if (NULL == addtl) {
+ S2.next = &S4;
+ } else {
+ /*
+ * splice in addtl between S2 and S4 -- we place S4 at the end
+ * of the input data chain
+ */
+ S2.next = addtl;
+ tempstr = addtl;
+ while (tempstr->next)
+ tempstr = tempstr->next;
+ tempstr->next = &S4;
+ }
/* 10.4.2 step 9 */
while (templen < (drbg_keylen(drbg) + (drbg_blocklen(drbg)))) {
--
1.9.3
next parent reply other threads:[~2014-06-21 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140620202418.GZ5015@mwanda>
2014-06-21 12:26 ` Stephan Mueller [this message]
2014-06-25 9:06 ` Herbert Xu
2014-07-04 10:50 ` Dan Carpenter
2014-07-05 0:00 ` Stephan Mueller
2014-07-05 0:36 ` Fengguang Wu
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=4892293.kf6KiPx6BS@myon.chronox.de \
--to=smueller@chronox.de \
--cc=dan.carpenter@oracle.com \
--cc=fengguang.wu@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=kbuild@01.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
all inboxes | Powered by JetHome®