diff options
author | miod <> | 2015-10-21 19:02:22 +0000 |
---|---|---|
committer | miod <> | 2015-10-21 19:02:22 +0000 |
commit | 1b13b85f2919becc500ee7d56c766f99acca6f75 (patch) | |
tree | 5ddf8c3dac23f792a949739928d1abaeec3376b7 /src/lib/libcrypto/bn/bn_err.c | |
parent | 8e683fccb8989afc1e9e74f5dc0a49b5a0275ec3 (diff) | |
download | openbsd-1b13b85f2919becc500ee7d56c766f99acca6f75.tar.gz openbsd-1b13b85f2919becc500ee7d56c766f99acca6f75.tar.bz2 openbsd-1b13b85f2919becc500ee7d56c766f99acca6f75.zip |
Reject too small bits value in BN_generate_prime_ex(), so that it does not risk
becoming negative in probable_prime_dh_safe(). Reported by Franck Denis who
noticed `openssl gendh 0' would segfault.
Fix adapted from OpenSSL RT#2701.
ok beck@ jsing@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_err.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_err.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c index 5a0f359d86..149e58eafc 100644 --- a/src/lib/libcrypto/bn/bn_err.c +++ b/src/lib/libcrypto/bn/bn_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_err.c,v 1.12 2014/07/10 22:45:56 jsing Exp $ */ | 1 | /* $OpenBSD: bn_err.c,v 1.13 2015/10/21 19:02:22 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -89,6 +89,7 @@ static ERR_STRING_DATA BN_str_functs[]= { | |||
89 | {ERR_FUNC(BN_F_BN_EXP), "BN_exp"}, | 89 | {ERR_FUNC(BN_F_BN_EXP), "BN_exp"}, |
90 | {ERR_FUNC(BN_F_BN_EXPAND2), "bn_expand2"}, | 90 | {ERR_FUNC(BN_F_BN_EXPAND2), "bn_expand2"}, |
91 | {ERR_FUNC(BN_F_BN_EXPAND_INTERNAL), "BN_EXPAND_INTERNAL"}, | 91 | {ERR_FUNC(BN_F_BN_EXPAND_INTERNAL), "BN_EXPAND_INTERNAL"}, |
92 | {ERR_FUNC(BN_F_BN_GENERATE_PRIME_EX), "BN_generate_prime_ex"}, | ||
92 | {ERR_FUNC(BN_F_BN_GF2M_MOD), "BN_GF2m_mod"}, | 93 | {ERR_FUNC(BN_F_BN_GF2M_MOD), "BN_GF2m_mod"}, |
93 | {ERR_FUNC(BN_F_BN_GF2M_MOD_EXP), "BN_GF2m_mod_exp"}, | 94 | {ERR_FUNC(BN_F_BN_GF2M_MOD_EXP), "BN_GF2m_mod_exp"}, |
94 | {ERR_FUNC(BN_F_BN_GF2M_MOD_MUL), "BN_GF2m_mod_mul"}, | 95 | {ERR_FUNC(BN_F_BN_GF2M_MOD_MUL), "BN_GF2m_mod_mul"}, |
@@ -119,6 +120,7 @@ static ERR_STRING_DATA BN_str_reasons[]= { | |||
119 | {ERR_REASON(BN_R_ARG2_LT_ARG3) , "arg2 lt arg3"}, | 120 | {ERR_REASON(BN_R_ARG2_LT_ARG3) , "arg2 lt arg3"}, |
120 | {ERR_REASON(BN_R_BAD_RECIPROCAL) , "bad reciprocal"}, | 121 | {ERR_REASON(BN_R_BAD_RECIPROCAL) , "bad reciprocal"}, |
121 | {ERR_REASON(BN_R_BIGNUM_TOO_LONG) , "bignum too long"}, | 122 | {ERR_REASON(BN_R_BIGNUM_TOO_LONG) , "bignum too long"}, |
123 | {ERR_REASON(BN_R_BITS_TOO_SMALL) , "bits too small"}, | ||
122 | {ERR_REASON(BN_R_CALLED_WITH_EVEN_MODULUS), "called with even modulus"}, | 124 | {ERR_REASON(BN_R_CALLED_WITH_EVEN_MODULUS), "called with even modulus"}, |
123 | {ERR_REASON(BN_R_DIV_BY_ZERO) , "div by zero"}, | 125 | {ERR_REASON(BN_R_DIV_BY_ZERO) , "div by zero"}, |
124 | {ERR_REASON(BN_R_ENCODING_ERROR) , "encoding error"}, | 126 | {ERR_REASON(BN_R_ENCODING_ERROR) , "encoding error"}, |