summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_add.c
diff options
context:
space:
mode:
authorjsing <>2022-11-24 01:30:01 +0000
committerjsing <>2022-11-24 01:30:01 +0000
commit8a7c8abfd4f8805f2a5101e89356e9411d908a0c (patch)
treefaea38f1c86dae9f6d4b143b2aa9f7752ecd0a34 /src/lib/libcrypto/bn/bn_add.c
parent095ccaedd0631462c52a1a2d9aa19b35c3e45b12 (diff)
downloadopenbsd-8a7c8abfd4f8805f2a5101e89356e9411d908a0c.tar.gz
openbsd-8a7c8abfd4f8805f2a5101e89356e9411d908a0c.tar.bz2
openbsd-8a7c8abfd4f8805f2a5101e89356e9411d908a0c.zip
Change bn_expand()/bn_wexpand() to indicate failure/success via 0/1.
Currently bn_expand()/bn_wexpand() return a BIGNUM *, however none of the callers use this (and many already treat it as a true/false value). Change these functions to return 0 on failure and 1 on success, revising callers that test against NULL in the process. ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_add.c')
-rw-r--r--src/lib/libcrypto/bn/bn_add.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_add.c b/src/lib/libcrypto/bn/bn_add.c
index 048a136b95..3a8c0e847a 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.13 2018/07/23 18:07:21 tb Exp $ */ 1/* $OpenBSD: bn_add.c,v 1.14 2022/11/24 01:30:01 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 *
@@ -115,7 +115,7 @@ BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
115 min = b->top; 115 min = b->top;
116 dif = max - min; 116 dif = max - min;
117 117
118 if (bn_wexpand(r, max + 1) == NULL) 118 if (!bn_wexpand(r, max + 1))
119 return 0; 119 return 0;
120 120
121 r->top = max; 121 r->top = max;
@@ -162,7 +162,7 @@ BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
162 return 0; 162 return 0;
163 } 163 }
164 164
165 if (bn_wexpand(r, max) == NULL) 165 if (!bn_wexpand(r, max))
166 return 0; 166 return 0;
167 167
168 ap = a->d; 168 ap = a->d;