diff options
-rw-r--r-- | src/lib/libcrypto/bn/bn.h | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/bn_isqrt.c | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 17 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index bef0a878e2..ba6c25ba0a 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn.h,v 1.56 2022/11/30 01:47:19 jsing Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.57 2022/12/17 15:56:25 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -329,6 +329,10 @@ int BN_is_one(const BIGNUM *a); | |||
329 | int BN_is_word(const BIGNUM *a, const BN_ULONG w); | 329 | int BN_is_word(const BIGNUM *a, const BN_ULONG w); |
330 | int BN_is_odd(const BIGNUM *a); | 330 | int BN_is_odd(const BIGNUM *a); |
331 | 331 | ||
332 | #if defined(LIBRESSL_INTERNAL) || defined(LIBRESSL_NEXT_API) | ||
333 | void BN_zero(BIGNUM *a); | ||
334 | int BN_one(BIGNUM *a); | ||
335 | #else | ||
332 | #define BN_one(a) BN_set_word((a), 1) | 336 | #define BN_one(a) BN_set_word((a), 1) |
333 | 337 | ||
334 | void BN_zero_ex(BIGNUM *a); | 338 | void BN_zero_ex(BIGNUM *a); |
@@ -338,6 +342,7 @@ void BN_zero_ex(BIGNUM *a); | |||
338 | #else | 342 | #else |
339 | #define BN_zero(a) (BN_set_word((a),0)) | 343 | #define BN_zero(a) (BN_set_word((a),0)) |
340 | #endif | 344 | #endif |
345 | #endif | ||
341 | 346 | ||
342 | const BIGNUM *BN_value_one(void); | 347 | const BIGNUM *BN_value_one(void); |
343 | char * BN_options(void); | 348 | char * BN_options(void); |
diff --git a/src/lib/libcrypto/bn/bn_isqrt.c b/src/lib/libcrypto/bn/bn_isqrt.c index 81f90b10be..ec77e1b078 100644 --- a/src/lib/libcrypto/bn/bn_isqrt.c +++ b/src/lib/libcrypto/bn/bn_isqrt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_isqrt.c,v 1.5 2022/12/01 21:59:54 tb Exp $ */ | 1 | /* $OpenBSD: bn_isqrt.c,v 1.6 2022/12/17 15:56:25 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
4 | * | 4 | * |
@@ -74,8 +74,7 @@ bn_isqrt(BIGNUM *out_sqrt, int *out_perfect, const BIGNUM *n, BN_CTX *in_ctx) | |||
74 | 74 | ||
75 | if (BN_is_zero(n)) { | 75 | if (BN_is_zero(n)) { |
76 | perfect = 1; | 76 | perfect = 1; |
77 | if (!BN_zero(a)) | 77 | BN_zero(a); |
78 | goto err; | ||
79 | goto done; | 78 | goto done; |
80 | } | 79 | } |
81 | 80 | ||
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 851c337ef0..c47f2fa024 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.66 2022/11/30 03:08:39 jsing Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.67 2022/12/17 15:56:25 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 | * |
@@ -998,11 +998,22 @@ BN_swap_ct(BN_ULONG condition, BIGNUM *a, BIGNUM *b, size_t nwords) | |||
998 | } | 998 | } |
999 | 999 | ||
1000 | void | 1000 | void |
1001 | BN_zero_ex(BIGNUM *a) | 1001 | BN_zero(BIGNUM *a) |
1002 | { | 1002 | { |
1003 | a->neg = 0; | 1003 | a->neg = 0; |
1004 | a->top = 0; | 1004 | a->top = 0; |
1005 | /* XXX: a->flags &= ~BN_FIXED_TOP */ | 1005 | } |
1006 | |||
1007 | void | ||
1008 | BN_zero_ex(BIGNUM *a) | ||
1009 | { | ||
1010 | BN_zero(a); | ||
1011 | } | ||
1012 | |||
1013 | int | ||
1014 | BN_one(BIGNUM *a) | ||
1015 | { | ||
1016 | return BN_set_word(a, 1); | ||
1006 | } | 1017 | } |
1007 | 1018 | ||
1008 | int | 1019 | int |