summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-07-13 06:36:08 +0000
committertb <>2022-07-13 06:36:08 +0000
commit6ba6561c6850c3479935c786316735760dd89a5d (patch)
treefeb03d2e17f1ee950029dd61edbbfe05adc49114 /src
parentb4a75c7477748bf7e2df56170376ff3869c7e610 (diff)
downloadopenbsd-6ba6561c6850c3479935c786316735760dd89a5d.tar.gz
openbsd-6ba6561c6850c3479935c786316735760dd89a5d.tar.bz2
openbsd-6ba6561c6850c3479935c786316735760dd89a5d.zip
Hook BPSW into BN_is_prime_fasttest_ex()
ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_prime.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c
index 9ab89695d8..0f3d85afb8 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.19 2022/06/18 15:52:35 tb Exp $ */ 1/* $OpenBSD: bn_prime.c,v 1.20 2022/07/13 06:36:08 tb 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 *
@@ -259,12 +259,22 @@ int
259BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 259BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
260 int do_trial_division, BN_GENCB *cb) 260 int do_trial_division, BN_GENCB *cb)
261{ 261{
262 int i, j, ret = -1;
263 int k;
264 BN_CTX *ctx = NULL; 262 BN_CTX *ctx = NULL;
265 BIGNUM *A1, *A1_odd, *check; /* taken from ctx */ 263 BIGNUM *A1, *A1_odd, *check; /* taken from ctx */
266 BN_MONT_CTX *mont = NULL; 264 BN_MONT_CTX *mont = NULL;
267 const BIGNUM *A = NULL; 265 const BIGNUM *A = NULL;
266 int i, j, k;
267 int ret = -1;
268
269#ifdef LIBRESSL_HAS_BPSW
270 int is_prime;
271
272 /* XXX - tickle BN_GENCB in bn_is_prime_bpsw(). */
273 if (!bn_is_prime_bpsw(&is_prime, a, ctx_passed))
274 return -1;
275
276 return is_prime;
277#endif
268 278
269 if (BN_cmp(a, BN_value_one()) <= 0) 279 if (BN_cmp(a, BN_value_one()) <= 0)
270 return 0; 280 return 0;