diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bn_arch.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h index f3653bcc40..927cd75208 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.13 2023/02/16 11:13:05 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.14 2024/03/26 06:09:25 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -42,6 +42,7 @@ | |||
| 42 | #define HAVE_BN_WORD_CLZ | 42 | #define HAVE_BN_WORD_CLZ |
| 43 | 43 | ||
| 44 | #if defined(__GNUC__) | 44 | #if defined(__GNUC__) |
| 45 | |||
| 45 | #define HAVE_BN_DIV_REM_WORDS_INLINE | 46 | #define HAVE_BN_DIV_REM_WORDS_INLINE |
| 46 | 47 | ||
| 47 | static inline void | 48 | static inline void |
| @@ -62,9 +63,7 @@ bn_div_rem_words_inline(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q, | |||
| 62 | *out_q = q; | 63 | *out_q = q; |
| 63 | *out_r = r; | 64 | *out_r = r; |
| 64 | } | 65 | } |
| 65 | #endif /* __GNUC__ */ | ||
| 66 | 66 | ||
| 67 | #if defined(__GNUC__) | ||
| 68 | #define HAVE_BN_MULW | 67 | #define HAVE_BN_MULW |
| 69 | 68 | ||
| 70 | static inline void | 69 | static inline void |
| @@ -84,6 +83,26 @@ bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) | |||
| 84 | *out_r1 = r1; | 83 | *out_r1 = r1; |
| 85 | *out_r0 = r0; | 84 | *out_r0 = r0; |
| 86 | } | 85 | } |
| 86 | |||
| 87 | #define HAVE_BN_SUBW | ||
| 88 | |||
| 89 | static inline void | ||
| 90 | bn_subw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_borrow, BN_ULONG *out_r0) | ||
| 91 | { | ||
| 92 | BN_ULONG borrow, r0; | ||
| 93 | |||
| 94 | __asm__ ( | ||
| 95 | "subq %3, %1 \n" | ||
| 96 | "setb %b0 \n" | ||
| 97 | "and $1, %0 \n" | ||
| 98 | : "=r"(borrow), "=r"(r0) | ||
| 99 | : "1"(a), "rm"(b) | ||
| 100 | : "cc"); | ||
| 101 | |||
| 102 | *out_borrow = borrow; | ||
| 103 | *out_r0 = r0; | ||
| 104 | } | ||
| 105 | |||
| 87 | #endif /* __GNUC__ */ | 106 | #endif /* __GNUC__ */ |
| 88 | 107 | ||
| 89 | #endif | 108 | #endif |
