diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h index 3ec88cd4f..1635aabd2 100644 --- a/crypto/bn/bn.h +++ b/crypto/bn/bn.h @@ -712,7 +712,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, * zero otherwise. */ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -/* BN_exp sets |r| equal to |a|^{|p|} mod |m|. It does so with the best +/* BN_mod_exp sets |r| equal to |a|^{|p|} mod |m|. It does so with the best * algorithm for the values provided and can run in constant time if * |BN_FLG_CONSTTIME| is set for |p|. It returns one on success or zero * otherwise. */ diff --git a/crypto/bn/random.c b/crypto/bn/random.c index 06e4c0fde..924aad71d 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;