From: Stephan Mueller <smueller@chronox.de>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Kees Cook <keescook@chromium.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au,
tytso@mit.edu, gregkh@linuxfoundation.org
Subject: Re: [PATCH 2/2] crypto/drbg: account for no longer returning -EALREADY
Date: Sat, 21 Oct 2017 21:22:52 +0200 [thread overview]
Message-ID: <1850213.PsBaiHKxjm@tauon.chronox.de> (raw)
In-Reply-To: <20171019204506.25090-2-Jason@zx2c4.com>
Am Donnerstag, 19. Oktober 2017, 22:45:06 CEST schrieb Jason A. Donenfeld:
Hi Jason,
> We now structure things in a way that assumes the seeding function is
> always eventually called.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> crypto/drbg.c | 20 +++++---------------
> 1 file changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index 70018397e59a..501e013cb96c 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1411,18 +1411,8 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)
>
> err = add_random_ready_callback(&drbg->random_ready);
>
> - switch (err) {
> - case 0:
> - break;
> -
> - case -EALREADY:
> - err = 0;
> - /* fall through */
> -
> - default:
> - drbg->random_ready.func = NULL;
> + if (err)
> return err;
Don't you change the logic flow here? In case the add_random_ready_callback
returns 0 because the ready function is already called due to crng_ready(),
the new code above in the patch set continues. But with the current code, it
will return at this point and do not perform the allocation below.
Ciao
Stephan
next prev parent reply other threads:[~2017-10-21 19:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAHmME9qwoSwFi7fsg1Z+gcEh1fBY+KY2rJ81UTHYn2ZMcjjwFA@mail.gmail.com>
2017-10-19 20:45 ` [PATCH 1/2] random: always call random ready function Jason A. Donenfeld
2017-10-19 20:45 ` [PATCH 2/2] crypto/drbg: account for no longer returning -EALREADY Jason A. Donenfeld
2017-10-21 19:22 ` Stephan Mueller [this message]
2017-10-19 20:45 ` [PATCH 1/2] random: always call random ready function Jason A. Donenfeld
2017-10-19 20:58 ` Kees Cook
2017-10-19 21:12 ` Jason A. Donenfeld
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=1850213.PsBaiHKxjm@tauon.chronox.de \
--to=smueller@chronox.de \
--cc=Jason@zx2c4.com \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=keescook@chromium.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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