summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_add.c6
-rw-r--r--src/lib/libcrypto/man/BN_add.37
2 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bn/bn_add.c b/src/lib/libcrypto/bn/bn_add.c
index c5bc024f3f..cfc04fd032 100644
--- a/src/lib/libcrypto/bn/bn_add.c
+++ b/src/lib/libcrypto/bn/bn_add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_add.c,v 1.19 2023/01/23 10:34:21 jsing Exp $ */ 1/* $OpenBSD: bn_add.c,v 1.20 2023/01/31 05:16:52 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 *
@@ -291,6 +291,10 @@ BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
291 rp = r->d; 291 rp = r->d;
292 292
293 borrow = bn_sub_words(rp, ap, bp, min); 293 borrow = bn_sub_words(rp, ap, bp, min);
294 if (dif == 0 && borrow > 0) {
295 BNerror(BN_R_ARG2_LT_ARG3);
296 return 0;
297 }
294 ap += min; 298 ap += min;
295 rp += min; 299 rp += min;
296 300
diff --git a/src/lib/libcrypto/man/BN_add.3 b/src/lib/libcrypto/man/BN_add.3
index c87514721a..a06b8af31c 100644
--- a/src/lib/libcrypto/man/BN_add.3
+++ b/src/lib/libcrypto/man/BN_add.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_add.3,v 1.17 2022/11/16 14:19:22 schwarze Exp $ 1.\" $OpenBSD: BN_add.3,v 1.18 2023/01/31 05:16:52 jsing Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: November 16 2022 $ 69.Dd $Mdocdate: January 31 2023 $
70.Dt BN_ADD 3 70.Dt BN_ADD 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -318,8 +318,7 @@ It requires the absolute value of
318.Fa a 318.Fa a
319to be greater than the absolute value of 319to be greater than the absolute value of
320.Fa b ; 320.Fa b ;
321otherwise, it will sometimes fail 321otherwise it will fail.
322and sometimes silently produce wrong results.
323.Fa r 322.Fa r
324may be the same 323may be the same
325.Vt BIGNUM 324.Vt BIGNUM