diff options
author | Pauli <pauli@openssl.org> | 2021-05-28 14:45:06 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-05-29 17:17:12 +1000 |
commit | 508258caa0299481d07d2118da5fe1524de0b6fd (patch) | |
tree | 0b87e475e5512a7e850409887aedbe5a067a5785 /include | |
parent | e587bccdf9152716e8ff74d8208a064cabf9f3e8 (diff) |
rand: add a strength argument to the BN and RAND RNG calls
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15513)
Diffstat (limited to 'include')
-rw-r--r-- | include/openssl/bn.h | 12 | ||||
-rw-r--r-- | include/openssl/rand.h | 17 |
2 files changed, 21 insertions, 8 deletions
diff --git a/include/openssl/bn.h b/include/openssl/bn.h index 2217ec0857..ecd7f01b9b 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h @@ -214,13 +214,17 @@ void BN_CTX_free(BN_CTX *c); void BN_CTX_start(BN_CTX *ctx); BIGNUM *BN_CTX_get(BN_CTX *ctx); void BN_CTX_end(BN_CTX *ctx); -int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx); +int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, + unsigned int strength, BN_CTX *ctx); int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx); +int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, + unsigned int strength, BN_CTX *ctx); int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, BN_CTX *ctx); +int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength, + BN_CTX *ctx); int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range, BN_CTX *ctx); +int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range, + unsigned int strength, BN_CTX *ctx); int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 diff --git a/include/openssl/rand.h b/include/openssl/rand.h index 100da328c3..304fd9fe1e 100644 --- a/include/openssl/rand.h +++ b/include/openssl/rand.h @@ -61,11 +61,20 @@ OSSL_DEPRECATEDIN_3_0 RAND_METHOD *RAND_OpenSSL(void); int RAND_bytes(unsigned char *buf, int num); int RAND_priv_bytes(unsigned char *buf, int num); -/* Equivalent of RAND_priv_bytes() but additionally taking an OSSL_LIB_CTX */ -int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num); +/* + * Equivalent of RAND_priv_bytes() but additionally taking an OSSL_LIB_CTX and + * a strength. + */ +int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num, + unsigned int strength); + +/* + * Equivalent of RAND_bytes() but additionally taking an OSSL_LIB_CTX and + * a strength. + */ +int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num, + unsigned int strength); -/* Equivalent of RAND_bytes() but additionally taking an OSSL_LIB_CTX */ -int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num); # ifndef OPENSSL_NO_DEPRECATED_1_1_0 OSSL_DEPRECATEDIN_1_1_0 int RAND_pseudo_bytes(unsigned char *buf, int num); # endif |