* Add GRND_INSECURE from Linux 5.6 to sys/random.h
@ 2020-04-03 21:12 Joseph Myers
2020-04-07 13:43 ` Adhemerval Zanella
0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2020-04-03 21:12 UTC (permalink / raw)
To: libc-alpha
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.
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
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Add GRND_INSECURE from Linux 5.6 to sys/random.h
2020-04-03 21:12 Add GRND_INSECURE from Linux 5.6 to sys/random.h Joseph Myers
@ 2020-04-07 13:43 ` Adhemerval Zanella
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2020-04-07 13:43 UTC (permalink / raw)
To: libc-alpha
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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-07 13:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 21:12 Add GRND_INSECURE from Linux 5.6 to sys/random.h Joseph Myers
2020-04-07 13:43 ` Adhemerval Zanella
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).