[openssl/openssl] 44fbe0: Enable the ability to seed the test RNG without ra...

Matt Caswell noreply at github.com
Wed Sep 20 08:05:30 UTC 2023


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 44fbe0de34137c7834dc81c1116d7538a2b4f773
      https://github.com/openssl/openssl/commit/44fbe0de34137c7834dc81c1116d7538a2b4f773
  Author: Matt Caswell <matt at openssl.org>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M test/testutil/driver.c

  Log Message:
  -----------
  Enable the ability to seed the test RNG without randomising test ordering

Numerous tests use the test_random() function to get a random number. If a
test fails then the seed that was used for the test RNG is displayed.
Setting the seed to the same value in a future run is supposed to cause the
same random numbers to be generated again.

The way to set the RNG seed again is to use the `OPENSSL_TEST_RAND_ORDER`
environment variable. However setting this environment variable *also*
randomises the test ordering as well as seeding the RNG. This in itself
calls test_random() so, in fact, when the test finally runs it gets
different random numbers to when it originally run (defeating the
repeatability objective).

This means that only way repeatability can be obtained is if the test was
originally run with `OPENSSL_TEST_RAND_ORDER` set to 0. If that wasn't done
then the seed printed when the test failed is not useful.

We introduce a new environment variable `OPENSSL_TEST_RAND_SEED` which can
be used to independently seed the test RNG without randomising the test
ordering. This can be used to get repeatability in cases where test ordering
randomisation was not done in the first place.

Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22118)


  Commit: 7251b2eb14427341630881cf10e4be3fa8661e8c
      https://github.com/openssl/openssl/commit/7251b2eb14427341630881cf10e4be3fa8661e8c
  Author: Matt Caswell <matt at openssl.org>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M test/README.md

  Log Message:
  -----------
  Document the OPENSSL_TEST_RAND_SEED environment variable

Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22118)


Compare: https://github.com/openssl/openssl/compare/be01f609f98a...7251b2eb1442


More information about the openssl-commits mailing list