summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_internal.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_internal.h b/src/lib/libcrypto/bn/bn_internal.h
index de5cd22424..003d8cac2d 100644
--- a/src/lib/libcrypto/bn/bn_internal.h
+++ b/src/lib/libcrypto/bn/bn_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_internal.h,v 1.1 2023/01/31 05:48:39 jsing Exp $ */ 1/* $OpenBSD: bn_internal.h,v 1.2 2023/02/14 17:58:26 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -22,6 +22,38 @@
22#ifndef HEADER_BN_INTERNAL_H 22#ifndef HEADER_BN_INTERNAL_H
23#define HEADER_BN_INTERNAL_H 23#define HEADER_BN_INTERNAL_H
24 24
25#ifndef HAVE_BN_CT_NE_ZERO
26static inline int
27bn_ct_ne_zero(BN_ULONG w)
28{
29 return (w | ~(w - 1)) >> (BN_BITS2 - 1);
30}
31#endif
32
33#ifndef HAVE_BN_CT_NE_ZERO_MASK
34static inline BN_ULONG
35bn_ct_ne_zero_mask(BN_ULONG w)
36{
37 return 0 - bn_ct_ne_zero(w);
38}
39#endif
40
41#ifndef HAVE_BN_CT_EQ_ZERO
42static inline int
43bn_ct_eq_zero(BN_ULONG w)
44{
45 return 1 - bn_ct_ne_zero(w);
46}
47#endif
48
49#ifndef HAVE_BN_CT_EQ_ZERO_MASK
50static inline BN_ULONG
51bn_ct_eq_zero_mask(BN_ULONG w)
52{
53 return 0 - bn_ct_eq_zero(w);
54}
55#endif
56
25#ifndef HAVE_BN_UMUL_HILO 57#ifndef HAVE_BN_UMUL_HILO
26#ifdef BN_LLONG 58#ifdef BN_LLONG
27static inline void 59static inline void