summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/bn/bn.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index 20212bf171..e9837cbbd6 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn.h,v 1.46 2021/12/04 15:53:01 tb Exp $ */ 1/* $OpenBSD: bn.h,v 1.47 2021/12/04 15:59:52 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -409,10 +409,21 @@ void *BN_GENCB_get_arg(BN_GENCB *cb);
409 (b) >= 308 ? 8 : \ 409 (b) >= 308 ? 8 : \
410 (b) >= 55 ? 27 : \ 410 (b) >= 55 ? 27 : \
411 /* b >= 6 */ 34) 411 /* b >= 6 */ 34)
412 412
413#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) 413#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
414 414
415/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */ 415#if defined(LIBRESSL_OPAQUE_BN) || defined(LIBRESSL_CRYPTO_INTERNAL)
416int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
417int BN_is_zero(const BIGNUM *a);
418int BN_is_one(const BIGNUM *a);
419int BN_is_word(const BIGNUM *a, const BN_ULONG w);
420int BN_is_odd(const BIGNUM *a);
421
422#define BN_one(a) BN_set_word((a), 1)
423
424void BN_zero_ex(BIGNUM *a);
425
426#else
416#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \ 427#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \
417 (((w) == 0) && ((a)->top == 0))) 428 (((w) == 0) && ((a)->top == 0)))
418#define BN_is_zero(a) ((a)->top == 0) 429#define BN_is_zero(a) ((a)->top == 0)
@@ -427,6 +438,7 @@ void *BN_GENCB_get_arg(BN_GENCB *cb);
427 _tmp_bn->top = 0; \ 438 _tmp_bn->top = 0; \
428 _tmp_bn->neg = 0; \ 439 _tmp_bn->neg = 0; \
429 } while(0) 440 } while(0)
441#endif /* LIBRESSL_OPAQUE_BN */
430 442
431#ifdef OPENSSL_NO_DEPRECATED 443#ifdef OPENSSL_NO_DEPRECATED
432#define BN_zero(a) BN_zero_ex(a) 444#define BN_zero(a) BN_zero_ex(a)