diff options
Diffstat (limited to 'src/lib/libcrypto/bn/arch/aarch64')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/aarch64/bn_arch.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h b/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h index 136adf0e97..5cf25adc48 100644 --- a/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.1 2023/01/20 10:04:33 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.2 2023/01/31 05:53:49 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -15,10 +15,30 @@ | |||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <openssl/bn.h> | ||
| 19 | |||
| 18 | #ifndef HEADER_BN_ARCH_H | 20 | #ifndef HEADER_BN_ARCH_H |
| 19 | #define HEADER_BN_ARCH_H | 21 | #define HEADER_BN_ARCH_H |
| 20 | 22 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 23 | #ifndef OPENSSL_NO_ASM |
| 22 | 24 | ||
| 25 | #if defined(__GNUC__) | ||
| 26 | #define HAVE_BN_UMUL_HILO | ||
| 27 | |||
| 28 | static inline void | ||
| 29 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | ||
| 30 | { | ||
| 31 | BN_ULONG h, l; | ||
| 32 | |||
| 33 | /* Unsigned multiplication using a umulh/mul pair. */ | ||
| 34 | __asm__ ("umulh %0, %2, %3; mul %1, %2, %3" | ||
| 35 | : "=r"(h), "=r"(l) | ||
| 36 | : "r"(a), "r"(b)); | ||
| 37 | |||
| 38 | *out_h = h; | ||
| 39 | *out_l = l; | ||
| 40 | } | ||
| 41 | #endif /* __GNUC__ */ | ||
| 42 | |||
| 23 | #endif | 43 | #endif |
| 24 | #endif | 44 | #endif |
