Make BN_num_bits() independent of bn->top.
authorjsing <jsing@openbsd.org>
Wed, 21 Jun 2023 07:41:55 +0000 (07:41 +0000)
committerjsing <jsing@openbsd.org>
Wed, 21 Jun 2023 07:41:55 +0000 (07:41 +0000)
commitb5aa971d26113b67975492c5e8e8476b3c5e81b6
treeda60a7fe8b0d559dc32b61e9276ddda069a286da
parentd1ac4eb253fca7bc79cbde208e085881b3264048
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@
lib/libcrypto/Makefile
lib/libcrypto/bn/bn_internal.h
lib/libcrypto/bn/bn_lib.c
lib/libcrypto/bn/bn_local.h
lib/libcrypto/bn/bn_primitives.c [new file with mode: 0644]