Provide and use bn_clzw() in place of bn_word_clz().
authorjsing <jsing@openbsd.org>
Wed, 21 Jun 2023 07:48:41 +0000 (07:48 +0000)
committerjsing <jsing@openbsd.org>
Wed, 21 Jun 2023 07:48:41 +0000 (07:48 +0000)
commit99bf4692bf9b3bd9f10766e8554a4dfc4f9ebe9b
treeaf5ba1b1e19f1d803edf377f6d4eca9090fe151d
parent297c3ba291b3015556550fcfed815a77d53e1189
Provide and use bn_clzw() in place of bn_word_clz().

On some architectures, we can provide an optimised (often single
instruction) count-leading-zero implementation. In order to do this
effectively, provide bn_clzw() as a static inline that can be replaced
by an architecture specific version. The default implementation defers
to the bn_word_clz() function (which may also be architecture specific).

ok tb@
lib/libcrypto/bn/bn_internal.h
lib/libcrypto/bn/bn_lib.c
lib/libcrypto/bn/bn_primitives.c