From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org, "Gaurav Jain" <gaurav.jain@nxp.com>,
"Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Corentin Labbe" <clabbe.montjoie@gmail.com>,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
"Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org,
"Eric Biggers" <ebiggers@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH 2/7] crypto: qcom-rng - Allow zero as a random number
Date: Mon, 15 Jun 2026 15:41:26 -0700 [thread overview]
Message-ID: <20260615224131.69370-3-ebiggers@kernel.org> (raw)
In-Reply-To: <20260615224131.69370-1-ebiggers@kernel.org>
Zero is a valid random number and needs to be allowed. Otherwise the
output is distinguishable from random.
Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support")
Cc: stable@vger.kernel.org
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
drivers/crypto/qcom-rng.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c
index f31a7fe07ba7..7058bd98f9e9 100644
--- a/drivers/crypto/qcom-rng.c
+++ b/drivers/crypto/qcom-rng.c
@@ -63,12 +63,10 @@ static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max)
200, 10000);
if (ret)
return ret;
val = readl_relaxed(rng->base + PRNG_DATA_OUT);
- if (!val)
- return -EINVAL;
if ((max - currsize) >= WORD_SZ) {
memcpy(data, &val, WORD_SZ);
data += WORD_SZ;
currsize += WORD_SZ;
--
2.54.0
next prev parent reply other threads:[~2026-06-15 22:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 22:41 [PATCH 0/7] Finish removing crypto_rng from drivers/crypto/ Eric Biggers
2026-06-15 22:41 ` [PATCH 1/7] crypto: qcom-rng - Enable clock in hwrng case Eric Biggers
2026-06-15 22:41 ` Eric Biggers [this message]
2026-06-15 22:41 ` [PATCH 3/7] crypto: qcom-rng - Remove crypto_rng interface Eric Biggers
2026-06-15 22:41 ` [PATCH 4/7] hwrng: qcom - Move qcom-rng.c into drivers/char/hw_random/ Eric Biggers
2026-06-15 22:41 ` [PATCH 5/7] crypto: sun8i-ce - Remove crypto_rng interface Eric Biggers
2026-06-15 22:41 ` [PATCH 6/7] crypto: sun8i-ss " Eric Biggers
2026-06-15 22:41 ` [PATCH 7/7] crypto: caam " Eric Biggers
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=20260615224131.69370-3-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=clabbe.montjoie@gmail.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.gupta@nxp.com \
--cc=stable@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