diff options
author | beck <> | 2017-01-21 04:34:16 +0000 |
---|---|---|
committer | beck <> | 2017-01-21 04:34:16 +0000 |
commit | 4a0bade454554867032b09f31d540604366200d5 (patch) | |
tree | b24f88bb958aa4c455625d665137d4f7ee6f13f0 /src | |
parent | 464e7bece5df6e122bd757c46dcadb142490e9a2 (diff) | |
download | openbsd-4a0bade454554867032b09f31d540604366200d5.tar.gz openbsd-4a0bade454554867032b09f31d540604366200d5.tar.bz2 openbsd-4a0bade454554867032b09f31d540604366200d5.zip |
/usr/bin/unifdef -D MONT_MUL_MOD -D MONT_EXP_WORD -D RECP_MUL_MOD -m bn_exp.c
with some style cleanup after. no binary change
ok jsing@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/bn/bn_exp.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index 64c8cbf375..83c62be25a 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.26 2016/09/03 17:26:29 bcook Exp $ */ | 1 | /* $OpenBSD: bn_exp.c,v 1.27 2017/01/21 04:34:16 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,37 +212,16 @@ BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, | |||
212 | * has been integrated into OpenSSL.) | 212 | * has been integrated into OpenSSL.) |
213 | */ | 213 | */ |
214 | 214 | ||
215 | #define MONT_MUL_MOD | ||
216 | #define MONT_EXP_WORD | ||
217 | #define RECP_MUL_MOD | ||
218 | |||
219 | #ifdef MONT_MUL_MOD | ||
220 | /* I have finally been able to take out this pre-condition of | ||
221 | * the top bit being set. It was caused by an error in BN_div | ||
222 | * with negatives. There was also another problem when for a^b%m | ||
223 | * a >= m. eay 07-May-97 */ | ||
224 | /* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */ | ||
225 | |||
226 | if (BN_is_odd(m)) { | 215 | if (BN_is_odd(m)) { |
227 | # ifdef MONT_EXP_WORD | ||
228 | if (a->top == 1 && !a->neg && | 216 | if (a->top == 1 && !a->neg && |
229 | (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) { | 217 | (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) { |
230 | BN_ULONG A = a->d[0]; | 218 | BN_ULONG A = a->d[0]; |
231 | ret = BN_mod_exp_mont_word(r, A,p, m,ctx, NULL); | 219 | ret = BN_mod_exp_mont_word(r, A,p, m,ctx, NULL); |
232 | } else | 220 | } else |
233 | # endif | ||
234 | ret = BN_mod_exp_mont(r, a,p, m,ctx, NULL); | 221 | ret = BN_mod_exp_mont(r, a,p, m,ctx, NULL); |
235 | } else | 222 | } else { |
236 | #endif | ||
237 | #ifdef RECP_MUL_MOD | ||
238 | { | ||
239 | ret = BN_mod_exp_recp(r, a,p, m, ctx); | 223 | ret = BN_mod_exp_recp(r, a,p, m, ctx); |
240 | } | 224 | } |
241 | #else | ||
242 | { | ||
243 | ret = BN_mod_exp_simple(r, a,p, m, ctx); | ||
244 | } | ||
245 | #endif | ||
246 | 225 | ||
247 | bn_check_top(r); | 226 | bn_check_top(r); |
248 | return (ret); | 227 | return (ret); |