diff options
author | Adam Langley <agl@chromium.org> | 2014-07-01 01:22:32 +0400 |
---|---|---|
committer | Adam Langley <agl@chromium.org> | 2014-07-01 01:22:32 +0400 |
commit | 5d17dd64ccff0b6840a0b673df29c97ec05be448 (patch) | |
tree | cfe8fd42f314b72f7b2d73b44147f12515429d36 /crypto/bn/random.c | |
parent | 389110ae89cb9cb66ece2cbe6c5f06be4344e3f5 (diff) |
Very minor BN fixes.
Fixes one comment that mentioned the wrong function name. Also causes
two BN random functions to fail when the output is NULL. Previously they
would silently do nothing.
Change-Id: I89796ab855ea32787765c301a478352287e61190
Diffstat (limited to 'crypto/bn/random.c')
-rw-r--r-- | crypto/bn/random.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/bn/random.c b/crypto/bn/random.c index 06e4c0fd..924aad71 100644 --- a/crypto/bn/random.c +++ b/crypto/bn/random.c @@ -117,6 +117,10 @@ int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) { uint8_t *buf = NULL; int ret = 0, bit, bytes, mask; + if (rnd == NULL) { + return 0; + } + if (bits == 0) { BN_zero(rnd); return 1; @@ -252,6 +256,10 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, const BIGNUM *priv, uint8_t *k_bytes = NULL; int ret = 0; + if (out == NULL) { + return 0; + } + if (BN_is_zero(range)) { OPENSSL_PUT_ERROR(BN, BN_generate_dsa_nonce, BN_R_DIV_BY_ZERO); goto err; |