summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_lib.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 389dd3ff3e..b8eb565497 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.86 2023/04/30 19:15:48 tb Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.87 2023/06/21 07:41:55 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 *
@@ -159,27 +159,6 @@ BN_value_one(void)
159 return &bn_value_one; 159 return &bn_value_one;
160} 160}
161 161
162#ifndef HAVE_BN_WORD_CLZ
163int
164bn_word_clz(BN_ULONG w)
165{
166 BN_ULONG bits, mask, shift;
167
168 bits = shift = BN_BITS2;
169 mask = 0;
170
171 while ((shift >>= 1) != 0) {
172 bits += (shift & mask) - (shift & ~mask);
173 mask = bn_ct_ne_zero_mask(w >> bits);
174 }
175 bits += 1 & mask;
176
177 bits -= bn_ct_eq_zero(w);
178
179 return BN_BITS2 - bits;
180}
181#endif
182
183int 162int
184BN_num_bits_word(BN_ULONG w) 163BN_num_bits_word(BN_ULONG w)
185{ 164{
@@ -187,13 +166,9 @@ BN_num_bits_word(BN_ULONG w)
187} 166}
188 167
189int 168int
190BN_num_bits(const BIGNUM *a) 169BN_num_bits(const BIGNUM *bn)
191{ 170{
192 int i = a->top - 1; 171 return bn_bitsize(bn);
193
194 if (BN_is_zero(a))
195 return 0;
196 return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
197} 172}
198 173
199void 174void