diff options
author | Matt Caswell <matt@openssl.org> | 2020-01-15 16:34:55 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-01-20 14:54:31 +0000 |
commit | 993ebac9ed38481e4d3795c437d4e98b985c68ce (patch) | |
tree | 0e30982d57fac860519fae6071b33988c7e68c11 /crypto/bn | |
parent | 09a4cb9ec7ea9ccb4885588ba3e138b9f5f606c7 (diff) |
Convert rand_bytes_ex and rand_priv_bytes_ex to public functions
These were initially added as internal functions only. However they will
also need to be used by libssl as well. Therefore it make sense to move
them into the public API.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10864)
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/bn_rand.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c index d61b08dba2..2428a49efd 100644 --- a/crypto/bn/bn_rand.c +++ b/crypto/bn/bn_rand.c @@ -47,8 +47,8 @@ static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, } /* make a random number and set the top and bottom bits */ - b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes) - : rand_priv_bytes_ex(libctx, buf, bytes); + b = flag == NORMAL ? RAND_bytes_ex(libctx, buf, bytes) + : RAND_priv_bytes_ex(libctx, buf, bytes); if (b <= 0) goto err; @@ -60,7 +60,7 @@ static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, unsigned char c; for (i = 0; i < bytes; i++) { - if (rand_bytes_ex(libctx, &c, 1) <= 0) + if (RAND_bytes_ex(libctx, &c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; @@ -280,7 +280,7 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, goto err; } for (done = 0; done < num_k_bytes;) { - if (!rand_priv_bytes_ex(libctx, random_bytes, sizeof(random_bytes))) + if (!RAND_priv_bytes_ex(libctx, random_bytes, sizeof(random_bytes))) goto err; if (!EVP_DigestInit_ex(mdctx, md, NULL) |