public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: Re: Add GRND_INSECURE from Linux 5.6 to sys/random.h
Date: Tue, 7 Apr 2020 10:43:02 -0300	[thread overview]
Message-ID: <de5cb149-90b5-55b9-756e-c2a03d976391@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2004032112060.11467@digraph.polyomino.org.uk>



On 03/04/2020 18:12, Joseph Myers wrote:
> This patch adds the GRND_INSECURE constant from Linux 5.6 to glibc's
> sys/random.h.  This is also added to the documentation.  The constant
> acts as a no-op for the Hurd implementation (as that doesn't check
> whether the flags are known), which is semantically fine, while older
> Linux kernels reject unknown flags with an EINVAL error.
> 
> Tested for x86_64.

LGTM, it follows Linux commit 75551dbf112c9. 

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> diff --git a/manual/crypt.texi b/manual/crypt.texi
> index c41b911c8f..af23dd7847 100644
> --- a/manual/crypt.texi
> +++ b/manual/crypt.texi
> @@ -301,6 +301,9 @@ booted and the randomness source has not yet been initialized.
>  @item GRND_NONBLOCK
>  Instead of blocking, return to the caller immediately if no data is
>  available.
> +
> +@item GRND_INSECURE
> +Write random data that may not be cryptographically secure.
>  @end table
>  
>  Unlike @code{getentropy}, the @code{getrandom} function is a
> diff --git a/stdlib/sys/random.h b/stdlib/sys/random.h
> index b351ef5c8c..1df6e9b844 100644
> --- a/stdlib/sys/random.h
> +++ b/stdlib/sys/random.h
> @@ -25,6 +25,7 @@
>  /* Flags for use with getrandom.  */
>  #define GRND_NONBLOCK 0x01
>  #define GRND_RANDOM 0x02
> +#define GRND_INSECURE 0x04
>  
>  __BEGIN_DECLS
>  
> 

      reply	other threads:[~2020-04-07 13:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 21:12 Joseph Myers
2020-04-07 13:43 ` Adhemerval Zanella [this message]

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=de5cb149-90b5-55b9-756e-c2a03d976391@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).