summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2025-12-15 12:09:46 +0000
committertb <>2025-12-15 12:09:46 +0000
commit341829195e0c845cf26339768f275f021b69fedc (patch)
treedc3752844fd792308ae3945985b5fed6b9382317 /src/lib
parent20d6e4cb31df6885cb225ebc24e9924458ff01aa (diff)
downloadopenbsd-341829195e0c845cf26339768f275f021b69fedc.tar.gz
openbsd-341829195e0c845cf26339768f275f021b69fedc.tar.bz2
openbsd-341829195e0c845cf26339768f275f021b69fedc.zip
BN_get_word(): return (BN_ULONG)-1 on error rather than BN_MASK2
While the latter is more general in that it also works on 1-complement achitectures, we don't care about that. Adjust documentation and the only error check for it in libcrypto. ok deraadt
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c4
-rw-r--r--src/lib/libcrypto/ec/ec_curve.c4
-rw-r--r--src/lib/libcrypto/man/BN_zero.36
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 3e451a6191..0326e72c4d 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.94 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.95 2025/12/15 12:09:46 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 *
@@ -349,7 +349,7 @@ BN_ULONG
349BN_get_word(const BIGNUM *a) 349BN_get_word(const BIGNUM *a)
350{ 350{
351 if (a->top > 1) 351 if (a->top > 1)
352 return BN_MASK2; 352 return (BN_ULONG)-1;
353 else if (a->top == 1) 353 else if (a->top == 1)
354 return a->d[0]; 354 return a->d[0];
355 /* a->top == 0 */ 355 /* a->top == 0 */
diff --git a/src/lib/libcrypto/ec/ec_curve.c b/src/lib/libcrypto/ec/ec_curve.c
index 2838965c1e..fda2681704 100644
--- a/src/lib/libcrypto/ec/ec_curve.c
+++ b/src/lib/libcrypto/ec/ec_curve.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_curve.c,v 1.59 2025/11/02 13:06:30 tb Exp $ */ 1/* $OpenBSD: ec_curve.c,v 1.60 2025/12/15 12:09:46 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -1392,7 +1392,7 @@ ec_curve_from_group(const EC_GROUP *group)
1392 if ((cofactor = EC_GROUP_get0_cofactor(group)) != NULL) { 1392 if ((cofactor = EC_GROUP_get0_cofactor(group)) != NULL) {
1393 BN_ULONG cofactor_word; 1393 BN_ULONG cofactor_word;
1394 1394
1395 if ((cofactor_word = BN_get_word(cofactor)) == BN_MASK2) 1395 if ((cofactor_word = BN_get_word(cofactor)) == (BN_ULONG)-1)
1396 goto err; 1396 goto err;
1397 if (cofactor_word > INT_MAX) 1397 if (cofactor_word > INT_MAX)
1398 goto err; 1398 goto err;
diff --git a/src/lib/libcrypto/man/BN_zero.3 b/src/lib/libcrypto/man/BN_zero.3
index 18a31a1080..d94a2a10da 100644
--- a/src/lib/libcrypto/man/BN_zero.3
+++ b/src/lib/libcrypto/man/BN_zero.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_zero.3,v 1.15 2025/06/14 06:48:47 tb Exp $ 1.\" $OpenBSD: BN_zero.3,v 1.16 2025/12/15 12:09:46 tb Exp $
2.\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3.\" selective merge up to: OpenSSL b713c4ff Jan 22 14:41:09 2018 -0500 3.\" selective merge up to: OpenSSL b713c4ff Jan 22 14:41:09 2018 -0500
4.\" 4.\"
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: June 14 2025 $ 70.Dd $Mdocdate: December 15 2025 $
71.Dt BN_ZERO 3 71.Dt BN_ZERO 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -132,7 +132,7 @@ This constant is useful for comparisons and assignments.
132.Fn BN_get_word 132.Fn BN_get_word
133returns the value 133returns the value
134.Fa a , 134.Fa a ,
135or a number with all bits set if 135or (BN_ULONG)\-1 if
136.Fa a 136.Fa a
137cannot be represented as a 137cannot be represented as a
138.Vt BN_ULONG . 138.Vt BN_ULONG .