diff options
| author | jsing <> | 2023-06-21 07:41:55 +0000 |
|---|---|---|
| committer | jsing <> | 2023-06-21 07:41:55 +0000 |
| commit | 88e97173c6cf4f4ec8c6138cff25d7b1c51a54e9 (patch) | |
| tree | fd160d47e7a4a56b7a1cb2b7a25b722886a6a475 /src/lib/libcrypto/bn/bn_internal.h | |
| parent | 49d358ba4102b545829d23eeead5528ff3342df4 (diff) | |
| download | openbsd-88e97173c6cf4f4ec8c6138cff25d7b1c51a54e9.tar.gz openbsd-88e97173c6cf4f4ec8c6138cff25d7b1c51a54e9.tar.bz2 openbsd-88e97173c6cf4f4ec8c6138cff25d7b1c51a54e9.zip | |
Make BN_num_bits() independent of bn->top.
Provide bn_bitsize(), which performs a constant time scan of a BN in order
to determine the bit size of the BN value. Use this for BN_num_bits() such
that it is no longer dependent on the bn->top value.
ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_internal.h')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_internal.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_internal.h b/src/lib/libcrypto/bn/bn_internal.h index 5f86e21330..f5c69c5d77 100644 --- a/src/lib/libcrypto/bn/bn_internal.h +++ b/src/lib/libcrypto/bn/bn_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_internal.h,v 1.12 2023/06/12 16:17:24 jsing Exp $ */ | 1 | /* $OpenBSD: bn_internal.h,v 1.13 2023/06/21 07:41:55 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -22,6 +22,10 @@ | |||
| 22 | #ifndef HEADER_BN_INTERNAL_H | 22 | #ifndef HEADER_BN_INTERNAL_H |
| 23 | #define HEADER_BN_INTERNAL_H | 23 | #define HEADER_BN_INTERNAL_H |
| 24 | 24 | ||
| 25 | int bn_word_clz(BN_ULONG w); | ||
| 26 | |||
| 27 | int bn_bitsize(const BIGNUM *bn); | ||
| 28 | |||
| 25 | #ifndef HAVE_BN_CT_NE_ZERO | 29 | #ifndef HAVE_BN_CT_NE_ZERO |
| 26 | static inline int | 30 | static inline int |
| 27 | bn_ct_ne_zero(BN_ULONG w) | 31 | bn_ct_ne_zero(BN_ULONG w) |
