From 8a7c8abfd4f8805f2a5101e89356e9411d908a0c Mon Sep 17 00:00:00 2001 From: jsing <> Date: Thu, 24 Nov 2022 01:30:01 +0000 Subject: 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@ --- src/lib/libcrypto/bn/bn_add.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/libcrypto/bn/bn_add.c') 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 @@ -/* $OpenBSD: bn_add.c,v 1.13 2018/07/23 18:07:21 tb Exp $ */ +/* $OpenBSD: bn_add.c,v 1.14 2022/11/24 01:30:01 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -115,7 +115,7 @@ BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) min = b->top; dif = max - min; - if (bn_wexpand(r, max + 1) == NULL) + if (!bn_wexpand(r, max + 1)) return 0; r->top = max; @@ -162,7 +162,7 @@ BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) return 0; } - if (bn_wexpand(r, max) == NULL) + if (!bn_wexpand(r, max)) return 0; ap = a->d; -- cgit v1.2.3-55-g6feb