diff options
author | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2018-02-08 23:04:16 +0100 |
---|---|---|
committer | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2018-02-13 17:32:54 +0100 |
commit | 8164d91d1802e6173291dee50923cc60fcd3bf72 (patch) | |
tree | bcfac577d81428846648be27e11675e6946d1653 /test | |
parent | 4f9dabbfe30c3539dd6cb0bd861ddb0127c11c20 (diff) |
DRBG: make the derivation function the default for ctr_drbg
The NIST standard presents two alternative ways for seeding the
CTR DRBG, depending on whether a derivation function is used or not.
In Section 10.2.1 of NIST SP800-90Ar1 the following is assessed:
The use of the derivation function is optional if either an
approved RBG or an entropy source provides full entropy output
when entropy input is requested by the DRBG mechanism.
Otherwise, the derivation function shall be used.
Since the OpenSSL DRBG supports being reseeded from low entropy random
sources (using RAND_POOL), the use of a derivation function is mandatory.
For that reason we change the default and replace the opt-in flag
RAND_DRBG_FLAG_CTR_USE_DF with an opt-out flag RAND_DRBG_FLAG_CTR_NO_DF.
This change simplifies the RAND_DRBG_new() calls.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5294)
Diffstat (limited to 'test')
-rw-r--r-- | test/drbgtest.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/drbgtest.c b/test/drbgtest.c index 6e916c42cb..c64628a756 100644 --- a/test/drbgtest.c +++ b/test/drbgtest.c @@ -88,16 +88,19 @@ typedef struct drbg_selftest_data_st { pr##_pr_returnedbits, sizeof(pr##_pr_returnedbits) \ } -#define make_drbg_test_data_df(nid, pr, p) \ - make_drbg_test_data(nid, RAND_DRBG_FLAG_CTR_USE_DF, pr, p) +#define make_drbg_test_data_use_df(nid, pr, p) \ + make_drbg_test_data(nid, 0, pr, p) + +#define make_drbg_test_data_no_df(nid, pr, p) \ + make_drbg_test_data(nid, RAND_DRBG_FLAG_CTR_NO_DF, pr, p) static DRBG_SELFTEST_DATA drbg_test[] = { - make_drbg_test_data (NID_aes_128_ctr, 0, aes_128_no_df, 0), - make_drbg_test_data (NID_aes_192_ctr, 0, aes_192_no_df, 0), - make_drbg_test_data (NID_aes_256_ctr, 0, aes_256_no_df, 1), - make_drbg_test_data_df(NID_aes_128_ctr, aes_128_use_df, 0), - make_drbg_test_data_df(NID_aes_192_ctr, aes_192_use_df, 0), - make_drbg_test_data_df(NID_aes_256_ctr, aes_256_use_df, 1), + make_drbg_test_data_no_df (NID_aes_128_ctr, aes_128_no_df, 0), + make_drbg_test_data_no_df (NID_aes_192_ctr, aes_192_no_df, 0), + make_drbg_test_data_no_df (NID_aes_256_ctr, aes_256_no_df, 1), + make_drbg_test_data_use_df(NID_aes_128_ctr, aes_128_use_df, 0), + make_drbg_test_data_use_df(NID_aes_192_ctr, aes_192_use_df, 0), + make_drbg_test_data_use_df(NID_aes_256_ctr, aes_256_use_df, 1), }; static int app_data_index; |