From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v8 2/9] stdlib: Add arc4random tests
Date: Tue, 12 Jul 2022 11:20:40 +0200 [thread overview]
Message-ID: <87r12qu1p3.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20220629213428.3065430-3-adhemerval.zanella@linaro.org> (Adhemerval Zanella's message of "Wed, 29 Jun 2022 18:34:21 -0300")
* Adhemerval Zanella:
> The basic tst-arc4random-chacha20.c checks if the output of ChaCha20
> implementation matches the reference test vectors from RFC8439.
>
> The tst-arc4random-fork.c check if subprocesses generate distinct
> streams of randomness (if fork handling is done correctly).
>
> The tst-arc4random-stats.c is a statistical test to the randomness of
> arc4random, arc4random_buf, and arc4random_uniform.
>
> The tst-arc4random-thread.c check if threads generate distinct streams
> of randomness (if function are thread-safe).
Maybe mention in the commit message that the tests are based on a
previous implementation, so the locking and race detection stuff is not
necessarily relevant with the per-thread state?
> --- /dev/null
> +++ b/stdlib/tst-arc4random-chacha20.c
> @@ -0,0 +1,167 @@
> +#include <arc4random.h>
> +#include <support/check.h>
> +#include <sys/cdefs.h>
> +
> +/* The test does not define CHACHA20_XOR_FINAL to mimic what arc4random
> + actual does. */
Missing space after .
> diff --git a/stdlib/tst-arc4random-fork.c b/stdlib/tst-arc4random-fork.c
> new file mode 100644
> index 0000000000..a7f7fee671
> --- /dev/null
> +++ b/stdlib/tst-arc4random-fork.c
> @@ -0,0 +1,198 @@
> +/* Test that subprocesses generate distinct streams of randomness.
> + Copyright (C) 2022 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
http:// instead of https://. (There are more occurrences.)
> +/* Collect random data from subprocesses and check that all the
> + results are unique. */
> +
> +#include <array_length.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include <support/check.h>
> +#include <support/support.h>
> +#include <support/xthread.h>
> +#include <support/xunistd.h>
> +#include <unistd.h>
> +
> +/* Perform multiple runs. The subsequent runs start with an
> + already-initialized random number generator. (The number 1500 was
> + seen to reproduce failures reliable in case of a race condition in
> + the fork detection code.) */
> +enum { runs = 1500 };
Comment is outdated, there is no fork detection code anymore.
> diff --git a/stdlib/tst-arc4random-thread.c b/stdlib/tst-arc4random-thread.c
> new file mode 100644
> index 0000000000..935cdcaf12
> --- /dev/null
> +++ b/stdlib/tst-arc4random-thread.c
> @@ -0,0 +1,341 @@
> +/* Test that threads generate distinct streams of randomness.
> + Copyright (C) 2018 Free Software Foundation, Inc.
Should be 2022.
Thanks,
Florian
next prev parent reply other threads:[~2022-07-12 9:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 21:34 [PATCH v8 0/9] Add arc4random support Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 1/9] stdlib: Add arc4random, arc4random_buf, and arc4random_uniform (BZ #4417) Adhemerval Zanella
2022-07-12 8:57 ` Florian Weimer
2022-07-12 16:57 ` Adhemerval Zanella Netto
2022-07-12 17:15 ` Florian Weimer
2022-07-12 17:21 ` Adhemerval Zanella Netto
2022-06-29 21:34 ` [PATCH v8 2/9] stdlib: Add arc4random tests Adhemerval Zanella
2022-07-12 9:20 ` Florian Weimer [this message]
2022-07-12 17:17 ` Adhemerval Zanella Netto
2022-06-29 21:34 ` [PATCH v8 3/9] benchtests: Add arc4random benchtest Adhemerval Zanella
2022-07-12 9:29 ` Florian Weimer
2022-07-12 17:26 ` Adhemerval Zanella Netto
2022-06-29 21:34 ` [PATCH v8 4/9] aarch64: Add optimized chacha20 Adhemerval Zanella
2022-07-12 9:30 ` Florian Weimer
2022-06-29 21:34 ` [PATCH v8 5/9] x86: Add SSE2 " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 6/9] x86: Add AVX2 " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 7/9] powerpc64: Add " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 8/9] s390x: " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 9/9] manual: Add documentation for arc4random functions Adhemerval Zanella
2022-06-29 21:45 ` Noah Goldstein
2022-06-29 21:53 ` Adhemerval Zanella
2022-06-29 22:05 ` Noah Goldstein
2022-06-30 7:58 ` Yann Droneaud
2022-06-30 19:37 ` Adhemerval Zanella
2022-06-29 21:55 ` Adhemerval Zanella
2022-07-12 9:31 ` [PATCH v8 0/9] Add arc4random support Florian Weimer
2022-07-12 17:36 ` Adhemerval Zanella Netto
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=87r12qu1p3.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=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).