Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Sandy Harris <sandyinchina@gmail.com>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Ted Ts'o <tytso@mit.edu>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH] In _extract-crng mix in 64 bits if possible
Date: Wed, 8 Sep 2021 20:43:04 -0700	[thread overview]
Message-ID: <YTmCyOTFADDSTdQm@sol.localdomain> (raw)
In-Reply-To: <CACXcFmm798P6mPErh9B4thz7uvBG1sUO-eJpa1MB+7ayDyTCvw@mail.gmail.com>

On Thu, Sep 09, 2021 at 10:49:20AM +0800, Sandy Harris wrote:
> On some machines arch_get_random_long() gives 64 bits.
> XORing it into a 32-bit state word uses only half of it.
> This change makes it use it all instead.
> 
> Signed-off-by: Sandy Harris <sandyinchina@gmail.com>
> 
> ---
>  drivers/char/random.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

This patch is corrupted and doesn't apply.

> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 57fe011fb5e4..fe7f3366b934 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -988,7 +988,8 @@ static void crng_reseed(struct crng_state *crng,
> struct entropy_store *r)
>  static void _extract_crng(struct crng_state *crng,
>                __u8 out[CHACHA_BLOCK_SIZE])
>  {
> -    unsigned long v, flags;
> +    unsigned long v, flags, *last;
> +    last = (unsigned long *) &crng->state[14] ;

How do you know that this has the right alignment for an unsigned long?

- Eric

  reply	other threads:[~2021-09-09  3:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  2:49 [PATCH] In _extract-crng mix in 64 bits if possible Sandy Harris
2021-09-09  3:43 ` Eric Biggers [this message]
2021-09-09  5:14   ` Sandy Harris
2021-09-11  7:19     ` [PATCH] random: In _extract_crng() " Sandy Harris
2021-09-13  2:52       ` Sandy Harris

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=YTmCyOTFADDSTdQm@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sandyinchina@gmail.com \
    --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