summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_exp.c')
-rw-r--r--src/lib/libcrypto/bn/bn_exp.c19
1 files changed, 8 insertions, 11 deletions
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