diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-04-01 12:44:57 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-04-01 12:44:57 +0000 |
commit | 7e216a3187badf3d3dd1b2fd3d489874ef3f8cee (patch) | |
tree | c6575b70b57811fff9b6842b15c283b3d3bb02d7 /lib/libcrypto/bn | |
parent | 0f5a73aab589b88a6682b5e9d5f93db307e1610c (diff) |
Pull static const data out of BN_value_one()
Also use C99 initializers for readability.
discussed with jsing
Diffstat (limited to 'lib/libcrypto/bn')
-rw-r--r-- | lib/libcrypto/bn/bn_lib.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/libcrypto/bn/bn_lib.c b/lib/libcrypto/bn/bn_lib.c index 980c9b54570..3ca2b7f14b0 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.79 2023/03/31 19:39:15 tb Exp $ */ +/* $OpenBSD: bn_lib.c,v 1.80 2023/04/01 12:44:56 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -209,15 +209,19 @@ BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags) dest->flags = dest_flags; } +static const BN_ULONG bn_value_one_data = 1; +static const BIGNUM bn_value_one = { + .d = (BN_ULONG *)&bn_value_one_data, + .top = 1, + .dmax = 1, + .neg = 0, + .flags = BN_FLG_STATIC_DATA, +}; + const BIGNUM * BN_value_one(void) { - static const BN_ULONG data_one = 1L; - static const BIGNUM const_one = { - (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA - }; - - return (&const_one); + return &bn_value_one; } #ifndef HAVE_BN_WORD_CLZ |