summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mont.c
diff options
context:
space:
mode:
authorjsing <>2022-11-26 13:56:33 +0000
committerjsing <>2022-11-26 13:56:33 +0000
commitbcbac728558eebfaa4404c405e7dc22769585345 (patch)
tree9f1339c5b70b0cfa4e8a0a5c70345e837a21ce77 /src/lib/libcrypto/bn/bn_mont.c
parent90d0616c736d954d327f399daa636de8e6a2c4d5 (diff)
downloadopenbsd-bcbac728558eebfaa4404c405e7dc22769585345.tar.gz
openbsd-bcbac728558eebfaa4404c405e7dc22769585345.tar.bz2
openbsd-bcbac728558eebfaa4404c405e7dc22769585345.zip
Remove BIGNUM consistency macros.
Compiling with BN_DEBUG (and if you want to take it further, BN_DEBUG_RAND) supposedly adds consistency checks to the BN code. These are rarely if ever used and introduce a bunch of clutter in the code. Furthermore, there are hacks in place to undo things that the debugging code does. Remove all of this mess and instead rely on always enabled checks, more readable code and proper regress coverage to ensure correct behaviour. "Good riddance." tb@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mont.c')
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index 251c67b89d..24bc41e886 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mont.c,v 1.30 2022/11/24 01:30:01 jsing Exp $ */ 1/* $OpenBSD: bn_mont.c,v 1.31 2022/11/26 13:56:33 jsing 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 *
@@ -152,7 +152,6 @@ BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
152 if ((tmp = BN_CTX_get(ctx)) == NULL) 152 if ((tmp = BN_CTX_get(ctx)) == NULL)
153 goto err; 153 goto err;
154 154
155 bn_check_top(tmp);
156 if (a == b) { 155 if (a == b) {
157 if (!BN_sqr(tmp, a, ctx)) 156 if (!BN_sqr(tmp, a, ctx))
158 goto err; 157 goto err;
@@ -168,7 +167,6 @@ BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
168 if (!BN_from_montgomery(r, tmp, mont, ctx)) 167 if (!BN_from_montgomery(r, tmp, mont, ctx))
169 goto err; 168 goto err;
170#endif 169#endif
171 bn_check_top(r);
172 ret = 1; 170 ret = 1;
173err: 171err:
174 BN_CTX_end(ctx); 172 BN_CTX_end(ctx);
@@ -272,7 +270,6 @@ BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
272#endif 270#endif
273 bn_correct_top(r); 271 bn_correct_top(r);
274 bn_correct_top(ret); 272 bn_correct_top(ret);
275 bn_check_top(ret);
276 273
277 return (1); 274 return (1);
278} 275}
@@ -318,7 +315,6 @@ BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx)
318 goto err; 315 goto err;
319 } 316 }
320 retn = 1; 317 retn = 1;
321 bn_check_top(ret);
322 318
323err: 319err:
324 BN_CTX_end(ctx); 320 BN_CTX_end(ctx);