From: jsing Date: Wed, 23 Nov 2022 02:46:09 +0000 (+0000) Subject: Move bn_expand() under bn_expand2(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=31e1f1a5d5bf9825a0a066fdd30d84be6ce8b725;p=openbsd Move bn_expand() under bn_expand2(). No functional change. ok tb@ --- diff --git a/lib/libcrypto/bn/bn_lib.c b/lib/libcrypto/bn/bn_lib.c index 18b213ff786..7ec338b9266 100644 --- a/lib/libcrypto/bn/bn_lib.c +++ b/lib/libcrypto/bn/bn_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_lib.c,v 1.56 2022/11/23 02:44:01 jsing Exp $ */ +/* $OpenBSD: bn_lib.c,v 1.57 2022/11/23 02:46:09 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -374,6 +374,18 @@ bn_expand2(BIGNUM *b, int words) return b; } +BIGNUM * +bn_expand(BIGNUM *a, int bits) +{ + if (bits > (INT_MAX - BN_BITS2 + 1)) + return (NULL); + + if (((bits + BN_BITS2 - 1) / BN_BITS2) <= a->dmax) + return (a); + + return bn_expand2(a, (bits + BN_BITS2 - 1) / BN_BITS2); +} + BIGNUM * BN_dup(const BIGNUM *a) { @@ -487,18 +499,6 @@ BN_get_word(const BIGNUM *a) return 0; } -BIGNUM * -bn_expand(BIGNUM *a, int bits) -{ - if (bits > (INT_MAX - BN_BITS2 + 1)) - return (NULL); - - if (((bits + BN_BITS2 - 1) / BN_BITS2) <= a->dmax) - return (a); - - return bn_expand2(a, (bits + BN_BITS2 - 1) / BN_BITS2); -} - int BN_set_word(BIGNUM *a, BN_ULONG w) {