summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index df43da5db6..851c337ef0 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.65 2022/11/30 02:52:25 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.66 2022/11/30 03:08:39 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 *
@@ -253,6 +253,13 @@ BN_num_bits(const BIGNUM *a)
253 return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 253 return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
254} 254}
255 255
256void
257bn_correct_top(BIGNUM *a)
258{
259 while (a->top > 0 && a->d[a->top - 1] == 0)
260 a->top--;
261}
262
256/* The caller MUST check that words > b->dmax before calling this */ 263/* The caller MUST check that words > b->dmax before calling this */
257static BN_ULONG * 264static BN_ULONG *
258bn_expand_internal(const BIGNUM *b, int words) 265bn_expand_internal(const BIGNUM *b, int words)