diff options
Diffstat (limited to 'src/lib/libcrypto/bn')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_add.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_blind.c | 13 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_ctx.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_div.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_err.c | 44 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_exp.c | 19 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_exp2.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_gcd.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_gf2m.c | 19 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mod.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mpi.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_prime.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_print.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_rand.c | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_recp.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_sqrt.c | 14 |
17 files changed, 70 insertions, 118 deletions
diff --git a/src/lib/libcrypto/bn/bn_add.c b/src/lib/libcrypto/bn/bn_add.c index ebc9b9b56b..334fb4f5d4 100644 --- a/src/lib/libcrypto/bn/bn_add.c +++ b/src/lib/libcrypto/bn/bn_add.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_add.c,v 1.10 2014/10/28 07:35:58 jsg Exp $ */ | 1 | /* $OpenBSD: bn_add.c,v 1.11 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -182,7 +182,7 @@ BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) | |||
| 182 | 182 | ||
| 183 | if (dif < 0) /* hmm... should not be happening */ | 183 | if (dif < 0) /* hmm... should not be happening */ |
| 184 | { | 184 | { |
| 185 | BNerr(BN_F_BN_USUB, BN_R_ARG2_LT_ARG3); | 185 | BNerror(BN_R_ARG2_LT_ARG3); |
| 186 | return (0); | 186 | return (0); |
| 187 | } | 187 | } |
| 188 | 188 | ||
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c index 28c6276751..ecd6718279 100644 --- a/src/lib/libcrypto/bn/bn_blind.c +++ b/src/lib/libcrypto/bn/bn_blind.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_blind.c,v 1.16 2017/01/21 11:00:46 beck Exp $ */ | 1 | /* $OpenBSD: bn_blind.c,v 1.17 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -144,7 +144,7 @@ BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) | |||
| 144 | bn_check_top(mod); | 144 | bn_check_top(mod); |
| 145 | 145 | ||
| 146 | if ((ret = calloc(1, sizeof(BN_BLINDING))) == NULL) { | 146 | if ((ret = calloc(1, sizeof(BN_BLINDING))) == NULL) { |
| 147 | BNerr(BN_F_BN_BLINDING_NEW, ERR_R_MALLOC_FAILURE); | 147 | BNerror(ERR_R_MALLOC_FAILURE); |
| 148 | return (NULL); | 148 | return (NULL); |
| 149 | } | 149 | } |
| 150 | if (A != NULL) { | 150 | if (A != NULL) { |
| @@ -194,7 +194,7 @@ BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | |||
| 194 | int ret = 0; | 194 | int ret = 0; |
| 195 | 195 | ||
| 196 | if ((b->A == NULL) || (b->Ai == NULL)) { | 196 | if ((b->A == NULL) || (b->Ai == NULL)) { |
| 197 | BNerr(BN_F_BN_BLINDING_UPDATE, BN_R_NOT_INITIALIZED); | 197 | BNerror(BN_R_NOT_INITIALIZED); |
| 198 | goto err; | 198 | goto err; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| @@ -235,7 +235,7 @@ BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | |||
| 235 | bn_check_top(n); | 235 | bn_check_top(n); |
| 236 | 236 | ||
| 237 | if ((b->A == NULL) || (b->Ai == NULL)) { | 237 | if ((b->A == NULL) || (b->Ai == NULL)) { |
| 238 | BNerr(BN_F_BN_BLINDING_CONVERT_EX, BN_R_NOT_INITIALIZED); | 238 | BNerror(BN_R_NOT_INITIALIZED); |
| 239 | return (0); | 239 | return (0); |
| 240 | } | 240 | } |
| 241 | 241 | ||
| @@ -273,7 +273,7 @@ BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | |||
| 273 | ret = BN_mod_mul(n, n, r, b->mod, ctx); | 273 | ret = BN_mod_mul(n, n, r, b->mod, ctx); |
| 274 | else { | 274 | else { |
| 275 | if (b->Ai == NULL) { | 275 | if (b->Ai == NULL) { |
| 276 | BNerr(BN_F_BN_BLINDING_INVERT_EX, BN_R_NOT_INITIALIZED); | 276 | BNerror(BN_R_NOT_INITIALIZED); |
| 277 | return (0); | 277 | return (0); |
| 278 | } | 278 | } |
| 279 | ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx); | 279 | ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx); |
| @@ -356,8 +356,7 @@ BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, | |||
| 356 | unsigned long error = ERR_peek_last_error(); | 356 | unsigned long error = ERR_peek_last_error(); |
| 357 | if (ERR_GET_REASON(error) == BN_R_NO_INVERSE) { | 357 | if (ERR_GET_REASON(error) == BN_R_NO_INVERSE) { |
| 358 | if (retry_counter-- == 0) { | 358 | if (retry_counter-- == 0) { |
| 359 | BNerr(BN_F_BN_BLINDING_CREATE_PARAM, | 359 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
| 360 | BN_R_TOO_MANY_ITERATIONS); | ||
| 361 | goto err; | 360 | goto err; |
| 362 | } | 361 | } |
| 363 | ERR_clear_error(); | 362 | ERR_clear_error(); |
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index eb2d6a43b3..1237ac1365 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_ctx.c,v 1.14 2015/02/10 09:50:12 miod Exp $ */ | 1 | /* $OpenBSD: bn_ctx.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Written by Ulf Moeller for the OpenSSL project. */ | 2 | /* Written by Ulf Moeller for the OpenSSL project. */ |
| 3 | /* ==================================================================== | 3 | /* ==================================================================== |
| 4 | * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. | 4 | * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. |
| @@ -225,7 +225,7 @@ BN_CTX_new(void) | |||
| 225 | { | 225 | { |
| 226 | BN_CTX *ret = malloc(sizeof(BN_CTX)); | 226 | BN_CTX *ret = malloc(sizeof(BN_CTX)); |
| 227 | if (!ret) { | 227 | if (!ret) { |
| 228 | BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); | 228 | BNerror(ERR_R_MALLOC_FAILURE); |
| 229 | return NULL; | 229 | return NULL; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -274,7 +274,7 @@ BN_CTX_start(BN_CTX *ctx) | |||
| 274 | ctx->err_stack++; | 274 | ctx->err_stack++; |
| 275 | /* (Try to) get a new frame pointer */ | 275 | /* (Try to) get a new frame pointer */ |
| 276 | else if (!BN_STACK_push(&ctx->stack, ctx->used)) { | 276 | else if (!BN_STACK_push(&ctx->stack, ctx->used)) { |
| 277 | BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); | 277 | BNerror(BN_R_TOO_MANY_TEMPORARY_VARIABLES); |
| 278 | ctx->err_stack++; | 278 | ctx->err_stack++; |
| 279 | } | 279 | } |
| 280 | CTXDBG_EXIT(ctx); | 280 | CTXDBG_EXIT(ctx); |
| @@ -312,7 +312,7 @@ BN_CTX_get(BN_CTX *ctx) | |||
| 312 | /* Setting too_many prevents repeated "get" attempts from | 312 | /* Setting too_many prevents repeated "get" attempts from |
| 313 | * cluttering the error stack. */ | 313 | * cluttering the error stack. */ |
| 314 | ctx->too_many = 1; | 314 | ctx->too_many = 1; |
| 315 | BNerr(BN_F_BN_CTX_GET, BN_R_TOO_MANY_TEMPORARY_VARIABLES); | 315 | BNerror(BN_R_TOO_MANY_TEMPORARY_VARIABLES); |
| 316 | return NULL; | 316 | return NULL; |
| 317 | } | 317 | } |
| 318 | /* OK, make sure the returned bignum is "zero" */ | 318 | /* OK, make sure the returned bignum is "zero" */ |
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index a8f7c9f384..f3a97bcc8d 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_div.c,v 1.24 2017/01/21 10:38:29 beck Exp $ */ | 1 | /* $OpenBSD: bn_div.c,v 1.25 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -131,7 +131,7 @@ BN_div_internal(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor | |||
| 131 | * in the case of 'num', so don't just rely on bn_check_top() for this one | 131 | * in the case of 'num', so don't just rely on bn_check_top() for this one |
| 132 | * (bn_check_top() works only for BN_DEBUG builds) */ | 132 | * (bn_check_top() works only for BN_DEBUG builds) */ |
| 133 | if (num->top > 0 && num->d[num->top - 1] == 0) { | 133 | if (num->top > 0 && num->d[num->top - 1] == 0) { |
| 134 | BNerr(BN_F_BN_DIV, BN_R_NOT_INITIALIZED); | 134 | BNerror(BN_R_NOT_INITIALIZED); |
| 135 | return 0; | 135 | return 0; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| @@ -146,7 +146,7 @@ BN_div_internal(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor | |||
| 146 | bn_check_top(divisor); | 146 | bn_check_top(divisor); |
| 147 | 147 | ||
| 148 | if (BN_is_zero(divisor)) { | 148 | if (BN_is_zero(divisor)) { |
| 149 | BNerr(BN_F_BN_DIV, BN_R_DIV_BY_ZERO); | 149 | BNerror(BN_R_DIV_BY_ZERO); |
| 150 | return (0); | 150 | return (0); |
| 151 | } | 151 | } |
| 152 | 152 | ||
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c index 149e58eafc..a693a8cbf8 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.13 2015/10/21 19:02:22 miod Exp $ */ | 1 | /* $OpenBSD: bn_err.c,v 1.14 2017/01/29 17:49:22 beck 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 | * |
| @@ -72,47 +72,7 @@ | |||
| 72 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason) | 72 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason) |
| 73 | 73 | ||
| 74 | static ERR_STRING_DATA BN_str_functs[]= { | 74 | static ERR_STRING_DATA BN_str_functs[]= { |
| 75 | {ERR_FUNC(BN_F_BNRAND), "BNRAND"}, | 75 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
| 76 | {ERR_FUNC(BN_F_BN_BLINDING_CONVERT_EX), "BN_BLINDING_convert_ex"}, | ||
| 77 | {ERR_FUNC(BN_F_BN_BLINDING_CREATE_PARAM), "BN_BLINDING_create_param"}, | ||
| 78 | {ERR_FUNC(BN_F_BN_BLINDING_INVERT_EX), "BN_BLINDING_invert_ex"}, | ||
| 79 | {ERR_FUNC(BN_F_BN_BLINDING_NEW), "BN_BLINDING_new"}, | ||
| 80 | {ERR_FUNC(BN_F_BN_BLINDING_UPDATE), "BN_BLINDING_update"}, | ||
| 81 | {ERR_FUNC(BN_F_BN_BN2DEC), "BN_bn2dec"}, | ||
| 82 | {ERR_FUNC(BN_F_BN_BN2HEX), "BN_bn2hex"}, | ||
| 83 | {ERR_FUNC(BN_F_BN_CTX_GET), "BN_CTX_get"}, | ||
| 84 | {ERR_FUNC(BN_F_BN_CTX_NEW), "BN_CTX_new"}, | ||
| 85 | {ERR_FUNC(BN_F_BN_CTX_START), "BN_CTX_start"}, | ||
| 86 | {ERR_FUNC(BN_F_BN_DIV), "BN_div"}, | ||
| 87 | {ERR_FUNC(BN_F_BN_DIV_NO_BRANCH), "BN_div_no_branch"}, | ||
| 88 | {ERR_FUNC(BN_F_BN_DIV_RECP), "BN_div_recp"}, | ||
| 89 | {ERR_FUNC(BN_F_BN_EXP), "BN_exp"}, | ||
| 90 | {ERR_FUNC(BN_F_BN_EXPAND2), "bn_expand2"}, | ||
| 91 | {ERR_FUNC(BN_F_BN_EXPAND_INTERNAL), "BN_EXPAND_INTERNAL"}, | ||
| 92 | {ERR_FUNC(BN_F_BN_GENERATE_PRIME_EX), "BN_generate_prime_ex"}, | ||
| 93 | {ERR_FUNC(BN_F_BN_GF2M_MOD), "BN_GF2m_mod"}, | ||
| 94 | {ERR_FUNC(BN_F_BN_GF2M_MOD_EXP), "BN_GF2m_mod_exp"}, | ||
| 95 | {ERR_FUNC(BN_F_BN_GF2M_MOD_MUL), "BN_GF2m_mod_mul"}, | ||
| 96 | {ERR_FUNC(BN_F_BN_GF2M_MOD_SOLVE_QUAD), "BN_GF2m_mod_solve_quad"}, | ||
| 97 | {ERR_FUNC(BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR), "BN_GF2m_mod_solve_quad_arr"}, | ||
| 98 | {ERR_FUNC(BN_F_BN_GF2M_MOD_SQR), "BN_GF2m_mod_sqr"}, | ||
| 99 | {ERR_FUNC(BN_F_BN_GF2M_MOD_SQRT), "BN_GF2m_mod_sqrt"}, | ||
| 100 | {ERR_FUNC(BN_F_BN_MOD_EXP2_MONT), "BN_mod_exp2_mont"}, | ||
| 101 | {ERR_FUNC(BN_F_BN_MOD_EXP_MONT), "BN_mod_exp_mont"}, | ||
| 102 | {ERR_FUNC(BN_F_BN_MOD_EXP_MONT_CONSTTIME), "BN_mod_exp_mont_consttime"}, | ||
| 103 | {ERR_FUNC(BN_F_BN_MOD_EXP_MONT_WORD), "BN_mod_exp_mont_word"}, | ||
| 104 | {ERR_FUNC(BN_F_BN_MOD_EXP_RECP), "BN_mod_exp_recp"}, | ||
| 105 | {ERR_FUNC(BN_F_BN_MOD_EXP_SIMPLE), "BN_mod_exp_simple"}, | ||
| 106 | {ERR_FUNC(BN_F_BN_MOD_INVERSE), "BN_mod_inverse"}, | ||
| 107 | {ERR_FUNC(BN_F_BN_MOD_INVERSE_NO_BRANCH), "BN_mod_inverse_no_branch"}, | ||
| 108 | {ERR_FUNC(BN_F_BN_MOD_LSHIFT_QUICK), "BN_mod_lshift_quick"}, | ||
| 109 | {ERR_FUNC(BN_F_BN_MOD_MUL_RECIPROCAL), "BN_mod_mul_reciprocal"}, | ||
| 110 | {ERR_FUNC(BN_F_BN_MOD_SQRT), "BN_mod_sqrt"}, | ||
| 111 | {ERR_FUNC(BN_F_BN_MPI2BN), "BN_mpi2bn"}, | ||
| 112 | {ERR_FUNC(BN_F_BN_NEW), "BN_new"}, | ||
| 113 | {ERR_FUNC(BN_F_BN_RAND), "BN_rand"}, | ||
| 114 | {ERR_FUNC(BN_F_BN_RAND_RANGE), "BN_rand_range"}, | ||
| 115 | {ERR_FUNC(BN_F_BN_USUB), "BN_usub"}, | ||
| 116 | {0, NULL} | 76 | {0, NULL} |
| 117 | }; | 77 | }; |
| 118 | 78 | ||
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index f650e94b09..d388758927 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_exp.c,v 1.29 2017/01/21 10:38:29 beck Exp $ */ | 1 | /* $OpenBSD: bn_exp.c,v 1.30 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -129,7 +129,7 @@ BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 129 | 129 | ||
| 130 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { | 130 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { |
| 131 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ | 131 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ |
| 132 | BNerr(BN_F_BN_EXP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 132 | BNerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 133 | return -1; | 133 | return -1; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -263,7 +263,7 @@ BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, | |||
| 263 | 263 | ||
| 264 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { | 264 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { |
| 265 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ | 265 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ |
| 266 | BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 266 | BNerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 267 | return -1; | 267 | return -1; |
| 268 | } | 268 | } |
| 269 | 269 | ||
| @@ -405,7 +405,7 @@ BN_mod_exp_mont_internal(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIG | |||
| 405 | bn_check_top(m); | 405 | bn_check_top(m); |
| 406 | 406 | ||
| 407 | if (!BN_is_odd(m)) { | 407 | if (!BN_is_odd(m)) { |
| 408 | BNerr(BN_F_BN_MOD_EXP_MONT, BN_R_CALLED_WITH_EVEN_MODULUS); | 408 | BNerror(BN_R_CALLED_WITH_EVEN_MODULUS); |
| 409 | return (0); | 409 | return (0); |
| 410 | } | 410 | } |
| 411 | 411 | ||
| @@ -662,8 +662,7 @@ BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, | |||
| 662 | bn_check_top(m); | 662 | bn_check_top(m); |
| 663 | 663 | ||
| 664 | if (!BN_is_odd(m)) { | 664 | if (!BN_is_odd(m)) { |
| 665 | BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, | 665 | BNerror(BN_R_CALLED_WITH_EVEN_MODULUS); |
| 666 | BN_R_CALLED_WITH_EVEN_MODULUS); | ||
| 667 | return (0); | 666 | return (0); |
| 668 | } | 667 | } |
| 669 | 668 | ||
| @@ -938,8 +937,7 @@ BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, | |||
| 938 | 937 | ||
| 939 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { | 938 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { |
| 940 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ | 939 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ |
| 941 | BNerr(BN_F_BN_MOD_EXP_MONT_WORD, | 940 | BNerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 942 | ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
| 943 | return -1; | 941 | return -1; |
| 944 | } | 942 | } |
| 945 | 943 | ||
| @@ -947,7 +945,7 @@ BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, | |||
| 947 | bn_check_top(m); | 945 | bn_check_top(m); |
| 948 | 946 | ||
| 949 | if (!BN_is_odd(m)) { | 947 | if (!BN_is_odd(m)) { |
| 950 | BNerr(BN_F_BN_MOD_EXP_MONT_WORD, BN_R_CALLED_WITH_EVEN_MODULUS); | 948 | BNerror(BN_R_CALLED_WITH_EVEN_MODULUS); |
| 951 | return (0); | 949 | return (0); |
| 952 | } | 950 | } |
| 953 | if (m->top == 1) | 951 | if (m->top == 1) |
| @@ -1076,8 +1074,7 @@ BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, | |||
| 1076 | 1074 | ||
| 1077 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { | 1075 | if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { |
| 1078 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ | 1076 | /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ |
| 1079 | BNerr(BN_F_BN_MOD_EXP_SIMPLE, | 1077 | BNerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1080 | ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
| 1081 | return -1; | 1078 | return -1; |
| 1082 | } | 1079 | } |
| 1083 | 1080 | ||
diff --git a/src/lib/libcrypto/bn/bn_exp2.c b/src/lib/libcrypto/bn/bn_exp2.c index 1d938d3818..372e1ee4ee 100644 --- a/src/lib/libcrypto/bn/bn_exp2.c +++ b/src/lib/libcrypto/bn/bn_exp2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_exp2.c,v 1.11 2017/01/21 10:38:29 beck Exp $ */ | 1 | /* $OpenBSD: bn_exp2.c,v 1.12 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -137,7 +137,7 @@ BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1, | |||
| 137 | bn_check_top(m); | 137 | bn_check_top(m); |
| 138 | 138 | ||
| 139 | if (!(m->d[0] & 1)) { | 139 | if (!(m->d[0] & 1)) { |
| 140 | BNerr(BN_F_BN_MOD_EXP2_MONT, BN_R_CALLED_WITH_EVEN_MODULUS); | 140 | BNerror(BN_R_CALLED_WITH_EVEN_MODULUS); |
| 141 | return (0); | 141 | return (0); |
| 142 | } | 142 | } |
| 143 | bits1 = BN_num_bits(p1); | 143 | bits1 = BN_num_bits(p1); |
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c index e2574c3304..469ae752fb 100644 --- a/src/lib/libcrypto/bn/bn_gcd.c +++ b/src/lib/libcrypto/bn/bn_gcd.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_gcd.c,v 1.14 2017/01/25 06:15:44 beck Exp $ */ | 1 | /* $OpenBSD: bn_gcd.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -527,7 +527,7 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct | |||
| 527 | goto err; | 527 | goto err; |
| 528 | } | 528 | } |
| 529 | } else { | 529 | } else { |
| 530 | BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); | 530 | BNerror(BN_R_NO_INVERSE); |
| 531 | goto err; | 531 | goto err; |
| 532 | } | 532 | } |
| 533 | ret = R; | 533 | ret = R; |
| @@ -709,7 +709,7 @@ BN_mod_inverse_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, | |||
| 709 | goto err; | 709 | goto err; |
| 710 | } | 710 | } |
| 711 | } else { | 711 | } else { |
| 712 | BNerr(BN_F_BN_MOD_INVERSE_NO_BRANCH, BN_R_NO_INVERSE); | 712 | BNerror(BN_R_NO_INVERSE); |
| 713 | goto err; | 713 | goto err; |
| 714 | } | 714 | } |
| 715 | ret = R; | 715 | ret = R; |
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 62395f60eb..8562b3f87e 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_gf2m.c,v 1.22 2016/09/03 14:37:00 bcook Exp $ */ | 1 | /* $OpenBSD: bn_gf2m.c,v 1.23 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -470,7 +470,7 @@ BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p) | |||
| 470 | bn_check_top(p); | 470 | bn_check_top(p); |
| 471 | ret = BN_GF2m_poly2arr(p, arr, sizeof(arr) / sizeof(arr[0])); | 471 | ret = BN_GF2m_poly2arr(p, arr, sizeof(arr) / sizeof(arr[0])); |
| 472 | if (!ret || ret > (int)(sizeof(arr) / sizeof(arr[0]))) { | 472 | if (!ret || ret > (int)(sizeof(arr) / sizeof(arr[0]))) { |
| 473 | BNerr(BN_F_BN_GF2M_MOD, BN_R_INVALID_LENGTH); | 473 | BNerror(BN_R_INVALID_LENGTH); |
| 474 | return 0; | 474 | return 0; |
| 475 | } | 475 | } |
| 476 | ret = BN_GF2m_mod_arr(r, a, arr); | 476 | ret = BN_GF2m_mod_arr(r, a, arr); |
| @@ -553,7 +553,7 @@ BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, | |||
| 553 | goto err; | 553 | goto err; |
| 554 | ret = BN_GF2m_poly2arr(p, arr, max); | 554 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 555 | if (!ret || ret > max) { | 555 | if (!ret || ret > max) { |
| 556 | BNerr(BN_F_BN_GF2M_MOD_MUL, BN_R_INVALID_LENGTH); | 556 | BNerror(BN_R_INVALID_LENGTH); |
| 557 | goto err; | 557 | goto err; |
| 558 | } | 558 | } |
| 559 | ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); | 559 | ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); |
| @@ -615,7 +615,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 615 | goto err; | 615 | goto err; |
| 616 | ret = BN_GF2m_poly2arr(p, arr, max); | 616 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 617 | if (!ret || ret > max) { | 617 | if (!ret || ret > max) { |
| 618 | BNerr(BN_F_BN_GF2M_MOD_SQR, BN_R_INVALID_LENGTH); | 618 | BNerror(BN_R_INVALID_LENGTH); |
| 619 | goto err; | 619 | goto err; |
| 620 | } | 620 | } |
| 621 | ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); | 621 | ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); |
| @@ -1052,7 +1052,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, | |||
| 1052 | goto err; | 1052 | goto err; |
| 1053 | ret = BN_GF2m_poly2arr(p, arr, max); | 1053 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 1054 | if (!ret || ret > max) { | 1054 | if (!ret || ret > max) { |
| 1055 | BNerr(BN_F_BN_GF2M_MOD_EXP, BN_R_INVALID_LENGTH); | 1055 | BNerror(BN_R_INVALID_LENGTH); |
| 1056 | goto err; | 1056 | goto err; |
| 1057 | } | 1057 | } |
| 1058 | ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx); | 1058 | ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx); |
| @@ -1114,7 +1114,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 1114 | goto err; | 1114 | goto err; |
| 1115 | ret = BN_GF2m_poly2arr(p, arr, max); | 1115 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 1116 | if (!ret || ret > max) { | 1116 | if (!ret || ret > max) { |
| 1117 | BNerr(BN_F_BN_GF2M_MOD_SQRT, BN_R_INVALID_LENGTH); | 1117 | BNerror(BN_R_INVALID_LENGTH); |
| 1118 | goto err; | 1118 | goto err; |
| 1119 | } | 1119 | } |
| 1120 | ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); | 1120 | ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); |
| @@ -1206,8 +1206,7 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
| 1206 | count++; | 1206 | count++; |
| 1207 | } while (BN_is_zero(w) && (count < MAX_ITERATIONS)); | 1207 | } while (BN_is_zero(w) && (count < MAX_ITERATIONS)); |
| 1208 | if (BN_is_zero(w)) { | 1208 | if (BN_is_zero(w)) { |
| 1209 | BNerr(BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR, | 1209 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
| 1210 | BN_R_TOO_MANY_ITERATIONS); | ||
| 1211 | goto err; | 1210 | goto err; |
| 1212 | } | 1211 | } |
| 1213 | } | 1212 | } |
| @@ -1217,7 +1216,7 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
| 1217 | if (!BN_GF2m_add(w, z, w)) | 1216 | if (!BN_GF2m_add(w, z, w)) |
| 1218 | goto err; | 1217 | goto err; |
| 1219 | if (BN_GF2m_cmp(w, a)) { | 1218 | if (BN_GF2m_cmp(w, a)) { |
| 1220 | BNerr(BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR, BN_R_NO_SOLUTION); | 1219 | BNerror(BN_R_NO_SOLUTION); |
| 1221 | goto err; | 1220 | goto err; |
| 1222 | } | 1221 | } |
| 1223 | 1222 | ||
| @@ -1251,7 +1250,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 1251 | goto err; | 1250 | goto err; |
| 1252 | ret = BN_GF2m_poly2arr(p, arr, max); | 1251 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 1253 | if (!ret || ret > max) { | 1252 | if (!ret || ret > max) { |
| 1254 | BNerr(BN_F_BN_GF2M_MOD_SOLVE_QUAD, BN_R_INVALID_LENGTH); | 1253 | BNerror(BN_R_INVALID_LENGTH); |
| 1255 | goto err; | 1254 | goto err; |
| 1256 | } | 1255 | } |
| 1257 | ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); | 1256 | ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 17f4ae89da..f2736e31c3 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lib.c,v 1.36 2016/03/15 20:50:22 krw Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.37 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -249,7 +249,7 @@ BN_new(void) | |||
| 249 | BIGNUM *ret; | 249 | BIGNUM *ret; |
| 250 | 250 | ||
| 251 | if ((ret = malloc(sizeof(BIGNUM))) == NULL) { | 251 | if ((ret = malloc(sizeof(BIGNUM))) == NULL) { |
| 252 | BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); | 252 | BNerror(ERR_R_MALLOC_FAILURE); |
| 253 | return (NULL); | 253 | return (NULL); |
| 254 | } | 254 | } |
| 255 | ret->flags = BN_FLG_MALLOCED; | 255 | ret->flags = BN_FLG_MALLOCED; |
| @@ -273,17 +273,16 @@ bn_expand_internal(const BIGNUM *b, int words) | |||
| 273 | bn_check_top(b); | 273 | bn_check_top(b); |
| 274 | 274 | ||
| 275 | if (words > (INT_MAX/(4*BN_BITS2))) { | 275 | if (words > (INT_MAX/(4*BN_BITS2))) { |
| 276 | BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); | 276 | BNerror(BN_R_BIGNUM_TOO_LONG); |
| 277 | return NULL; | 277 | return NULL; |
| 278 | } | 278 | } |
| 279 | if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { | 279 | if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { |
| 280 | BNerr(BN_F_BN_EXPAND_INTERNAL, | 280 | BNerror(BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); |
| 281 | BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); | ||
| 282 | return (NULL); | 281 | return (NULL); |
| 283 | } | 282 | } |
| 284 | a = A = reallocarray(NULL, words, sizeof(BN_ULONG)); | 283 | a = A = reallocarray(NULL, words, sizeof(BN_ULONG)); |
| 285 | if (A == NULL) { | 284 | if (A == NULL) { |
| 286 | BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); | 285 | BNerror(ERR_R_MALLOC_FAILURE); |
| 287 | return (NULL); | 286 | return (NULL); |
| 288 | } | 287 | } |
| 289 | #if 1 | 288 | #if 1 |
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c index 4c30c098d4..897ff434e9 100644 --- a/src/lib/libcrypto/bn/bn_mod.c +++ b/src/lib/libcrypto/bn/bn_mod.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mod.c,v 1.11 2017/01/21 10:38:29 beck Exp $ */ | 1 | /* $OpenBSD: bn_mod.c,v 1.12 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * for the OpenSSL project. */ | 3 | * for the OpenSSL project. */ |
| 4 | /* ==================================================================== | 4 | /* ==================================================================== |
| @@ -278,7 +278,7 @@ BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m) | |||
| 278 | /* max_shift >= 0 */ | 278 | /* max_shift >= 0 */ |
| 279 | 279 | ||
| 280 | if (max_shift < 0) { | 280 | if (max_shift < 0) { |
| 281 | BNerr(BN_F_BN_MOD_LSHIFT_QUICK, BN_R_INPUT_NOT_REDUCED); | 281 | BNerror(BN_R_INPUT_NOT_REDUCED); |
| 282 | return 0; | 282 | return 0; |
| 283 | } | 283 | } |
| 284 | 284 | ||
diff --git a/src/lib/libcrypto/bn/bn_mpi.c b/src/lib/libcrypto/bn/bn_mpi.c index cf4c7d8d24..4801192b50 100644 --- a/src/lib/libcrypto/bn/bn_mpi.c +++ b/src/lib/libcrypto/bn/bn_mpi.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mpi.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: bn_mpi.c,v 1.8 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -98,13 +98,13 @@ BN_mpi2bn(const unsigned char *d, int n, BIGNUM *a) | |||
| 98 | int neg = 0; | 98 | int neg = 0; |
| 99 | 99 | ||
| 100 | if (n < 4) { | 100 | if (n < 4) { |
| 101 | BNerr(BN_F_BN_MPI2BN, BN_R_INVALID_LENGTH); | 101 | BNerror(BN_R_INVALID_LENGTH); |
| 102 | return (NULL); | 102 | return (NULL); |
| 103 | } | 103 | } |
| 104 | len = ((long)d[0] << 24) | ((long)d[1] << 16) | ((int)d[2] << 8) | | 104 | len = ((long)d[0] << 24) | ((long)d[1] << 16) | ((int)d[2] << 8) | |
| 105 | (int)d[3]; | 105 | (int)d[3]; |
| 106 | if ((len + 4) != n) { | 106 | if ((len + 4) != n) { |
| 107 | BNerr(BN_F_BN_MPI2BN, BN_R_ENCODING_ERROR); | 107 | BNerror(BN_R_ENCODING_ERROR); |
| 108 | return (NULL); | 108 | return (NULL); |
| 109 | } | 109 | } |
| 110 | 110 | ||
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c index ec8217ef69..e78c5686ab 100644 --- a/src/lib/libcrypto/bn/bn_prime.c +++ b/src/lib/libcrypto/bn/bn_prime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_prime.c,v 1.17 2017/01/21 10:38:29 beck Exp $ */ | 1 | /* $OpenBSD: bn_prime.c,v 1.18 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -173,7 +173,7 @@ BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, | |||
| 173 | * There are no prime numbers smaller than 2, and the smallest | 173 | * There are no prime numbers smaller than 2, and the smallest |
| 174 | * safe prime (7) spans three bits. | 174 | * safe prime (7) spans three bits. |
| 175 | */ | 175 | */ |
| 176 | BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL); | 176 | BNerror(BN_R_BITS_TOO_SMALL); |
| 177 | return 0; | 177 | return 0; |
| 178 | } | 178 | } |
| 179 | 179 | ||
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index f526065592..de67c03c14 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_print.c,v 1.30 2016/10/17 03:30:14 guenther Exp $ */ | 1 | /* $OpenBSD: bn_print.c,v 1.31 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -80,7 +80,7 @@ BN_bn2hex(const BIGNUM *a) | |||
| 80 | 80 | ||
| 81 | buf = malloc(BN_is_negative(a) + a->top * BN_BYTES * 2 + 2); | 81 | buf = malloc(BN_is_negative(a) + a->top * BN_BYTES * 2 + 2); |
| 82 | if (buf == NULL) { | 82 | if (buf == NULL) { |
| 83 | BNerr(BN_F_BN_BN2HEX, ERR_R_MALLOC_FAILURE); | 83 | BNerror(ERR_R_MALLOC_FAILURE); |
| 84 | goto err; | 84 | goto err; |
| 85 | } | 85 | } |
| 86 | p = buf; | 86 | p = buf; |
| @@ -118,7 +118,7 @@ BN_bn2dec(const BIGNUM *a) | |||
| 118 | if (BN_is_zero(a)) { | 118 | if (BN_is_zero(a)) { |
| 119 | buf = malloc(BN_is_negative(a) + 2); | 119 | buf = malloc(BN_is_negative(a) + 2); |
| 120 | if (buf == NULL) { | 120 | if (buf == NULL) { |
| 121 | BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE); | 121 | BNerror(ERR_R_MALLOC_FAILURE); |
| 122 | goto err; | 122 | goto err; |
| 123 | } | 123 | } |
| 124 | p = buf; | 124 | p = buf; |
| @@ -140,7 +140,7 @@ BN_bn2dec(const BIGNUM *a) | |||
| 140 | bn_data = reallocarray(NULL, bn_data_num, sizeof(BN_ULONG)); | 140 | bn_data = reallocarray(NULL, bn_data_num, sizeof(BN_ULONG)); |
| 141 | buf = malloc(num + 3); | 141 | buf = malloc(num + 3); |
| 142 | if ((buf == NULL) || (bn_data == NULL)) { | 142 | if ((buf == NULL) || (bn_data == NULL)) { |
| 143 | BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE); | 143 | BNerror(ERR_R_MALLOC_FAILURE); |
| 144 | goto err; | 144 | goto err; |
| 145 | } | 145 | } |
| 146 | if ((t = BN_dup(a)) == NULL) | 146 | if ((t = BN_dup(a)) == NULL) |
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index 783f6c22f8..812fa6a575 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_rand.c,v 1.18 2015/09/10 15:56:25 jsing Exp $ */ | 1 | /* $OpenBSD: bn_rand.c,v 1.19 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -125,7 +125,7 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
| 125 | int ret = 0, bit, bytes, mask; | 125 | int ret = 0, bit, bytes, mask; |
| 126 | 126 | ||
| 127 | if (rnd == NULL) { | 127 | if (rnd == NULL) { |
| 128 | BNerr(BN_F_BNRAND, ERR_R_PASSED_NULL_PARAMETER); | 128 | BNerror(ERR_R_PASSED_NULL_PARAMETER); |
| 129 | return (0); | 129 | return (0); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| @@ -140,7 +140,7 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
| 140 | 140 | ||
| 141 | buf = malloc(bytes); | 141 | buf = malloc(bytes); |
| 142 | if (buf == NULL) { | 142 | if (buf == NULL) { |
| 143 | BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); | 143 | BNerror(ERR_R_MALLOC_FAILURE); |
| 144 | goto err; | 144 | goto err; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| @@ -224,7 +224,7 @@ bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) | |||
| 224 | int count = 100; | 224 | int count = 100; |
| 225 | 225 | ||
| 226 | if (range->neg || BN_is_zero(range)) { | 226 | if (range->neg || BN_is_zero(range)) { |
| 227 | BNerr(BN_F_BN_RAND_RANGE, BN_R_INVALID_RANGE); | 227 | BNerror(BN_R_INVALID_RANGE); |
| 228 | return 0; | 228 | return 0; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| @@ -254,8 +254,7 @@ bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) | |||
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | if (!--count) { | 256 | if (!--count) { |
| 257 | BNerr(BN_F_BN_RAND_RANGE, | 257 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
| 258 | BN_R_TOO_MANY_ITERATIONS); | ||
| 259 | return 0; | 258 | return 0; |
| 260 | } | 259 | } |
| 261 | 260 | ||
| @@ -267,8 +266,7 @@ bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) | |||
| 267 | return 0; | 266 | return 0; |
| 268 | 267 | ||
| 269 | if (!--count) { | 268 | if (!--count) { |
| 270 | BNerr(BN_F_BN_RAND_RANGE, | 269 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
| 271 | BN_R_TOO_MANY_ITERATIONS); | ||
| 272 | return 0; | 270 | return 0; |
| 273 | } | 271 | } |
| 274 | } while (BN_cmp(r, range) >= 0); | 272 | } while (BN_cmp(r, range) >= 0); |
diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c index aae7c7ef85..6588d33033 100644 --- a/src/lib/libcrypto/bn/bn_recp.c +++ b/src/lib/libcrypto/bn/bn_recp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_recp.c,v 1.14 2017/01/21 10:38:29 beck Exp $ */ | 1 | /* $OpenBSD: bn_recp.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -212,7 +212,7 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, | |||
| 212 | j = 0; | 212 | j = 0; |
| 213 | while (BN_ucmp(r, &(recp->N)) >= 0) { | 213 | while (BN_ucmp(r, &(recp->N)) >= 0) { |
| 214 | if (j++ > 2) { | 214 | if (j++ > 2) { |
| 215 | BNerr(BN_F_BN_DIV_RECP, BN_R_BAD_RECIPROCAL); | 215 | BNerror(BN_R_BAD_RECIPROCAL); |
| 216 | goto err; | 216 | goto err; |
| 217 | } | 217 | } |
| 218 | if (!BN_usub(r, r, &(recp->N))) | 218 | if (!BN_usub(r, r, &(recp->N))) |
diff --git a/src/lib/libcrypto/bn/bn_sqrt.c b/src/lib/libcrypto/bn/bn_sqrt.c index 5928dfc79d..8514f23a27 100644 --- a/src/lib/libcrypto/bn/bn_sqrt.c +++ b/src/lib/libcrypto/bn/bn_sqrt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_sqrt.c,v 1.8 2017/01/21 09:38:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_sqrt.c,v 1.9 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * and Bodo Moeller for the OpenSSL project. */ | 3 | * and Bodo Moeller for the OpenSSL project. */ |
| 4 | /* ==================================================================== | 4 | /* ==================================================================== |
| @@ -89,7 +89,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 89 | return ret; | 89 | return ret; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | BNerr(BN_F_BN_MOD_SQRT, BN_R_P_IS_NOT_PRIME); | 92 | BNerror(BN_R_P_IS_NOT_PRIME); |
| 93 | return (NULL); | 93 | return (NULL); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| @@ -250,7 +250,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 250 | goto end; | 250 | goto end; |
| 251 | if (r == 0) { | 251 | if (r == 0) { |
| 252 | /* m divides p */ | 252 | /* m divides p */ |
| 253 | BNerr(BN_F_BN_MOD_SQRT, BN_R_P_IS_NOT_PRIME); | 253 | BNerror(BN_R_P_IS_NOT_PRIME); |
| 254 | goto end; | 254 | goto end; |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| @@ -262,7 +262,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 262 | * Even if p is not prime, we should have found some y | 262 | * Even if p is not prime, we should have found some y |
| 263 | * such that r == -1. | 263 | * such that r == -1. |
| 264 | */ | 264 | */ |
| 265 | BNerr(BN_F_BN_MOD_SQRT, BN_R_TOO_MANY_ITERATIONS); | 265 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
| 266 | goto end; | 266 | goto end; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| @@ -275,7 +275,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 275 | if (!BN_mod_exp_ct(y, y, q, p, ctx)) | 275 | if (!BN_mod_exp_ct(y, y, q, p, ctx)) |
| 276 | goto end; | 276 | goto end; |
| 277 | if (BN_is_one(y)) { | 277 | if (BN_is_one(y)) { |
| 278 | BNerr(BN_F_BN_MOD_SQRT, BN_R_P_IS_NOT_PRIME); | 278 | BNerror(BN_R_P_IS_NOT_PRIME); |
| 279 | goto end; | 279 | goto end; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| @@ -359,7 +359,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 359 | while (!BN_is_one(t)) { | 359 | while (!BN_is_one(t)) { |
| 360 | i++; | 360 | i++; |
| 361 | if (i == e) { | 361 | if (i == e) { |
| 362 | BNerr(BN_F_BN_MOD_SQRT, BN_R_NOT_A_SQUARE); | 362 | BNerror(BN_R_NOT_A_SQUARE); |
| 363 | goto end; | 363 | goto end; |
| 364 | } | 364 | } |
| 365 | if (!BN_mod_mul(t, t, t, p, ctx)) | 365 | if (!BN_mod_mul(t, t, t, p, ctx)) |
| @@ -392,7 +392,7 @@ vrfy: | |||
| 392 | err = 1; | 392 | err = 1; |
| 393 | 393 | ||
| 394 | if (!err && 0 != BN_cmp(x, A)) { | 394 | if (!err && 0 != BN_cmp(x, A)) { |
| 395 | BNerr(BN_F_BN_MOD_SQRT, BN_R_NOT_A_SQUARE); | 395 | BNerror(BN_R_NOT_A_SQUARE); |
| 396 | err = 1; | 396 | err = 1; |
| 397 | } | 397 | } |
| 398 | } | 398 | } |
