diff options
| author | jsing <> | 2023-06-21 07:48:41 +0000 |
|---|---|---|
| committer | jsing <> | 2023-06-21 07:48:41 +0000 |
| commit | b0edbf3f98eba4b1effd31584dae0af06eb2deff (patch) | |
| tree | 279fd7ba83f6adb19a12c4a0d34196850a955e43 /src/lib/libcrypto/bn/bn_lib.c | |
| parent | 88e97173c6cf4f4ec8c6138cff25d7b1c51a54e9 (diff) | |
| download | openbsd-b0edbf3f98eba4b1effd31584dae0af06eb2deff.tar.gz openbsd-b0edbf3f98eba4b1effd31584dae0af06eb2deff.tar.bz2 openbsd-b0edbf3f98eba4b1effd31584dae0af06eb2deff.zip | |
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@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index b8eb565497..bac0290efa 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lib.c,v 1.87 2023/06/21 07:41:55 jsing Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.88 2023/06/21 07:48:41 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -162,7 +162,7 @@ BN_value_one(void) | |||
| 162 | int | 162 | int |
| 163 | BN_num_bits_word(BN_ULONG w) | 163 | BN_num_bits_word(BN_ULONG w) |
| 164 | { | 164 | { |
| 165 | return BN_BITS2 - bn_word_clz(w); | 165 | return BN_BITS2 - bn_clzw(w); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | int | 168 | int |
