diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/alpha/bn_arch.h | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/riscv64/bn_arch.h | 26 |
3 files changed, 67 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/arch/alpha/bn_arch.h b/src/lib/libcrypto/bn/arch/alpha/bn_arch.h index 136adf0e97..9bc00911ab 100644 --- a/src/lib/libcrypto/bn/arch/alpha/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/alpha/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:57:08 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,5 +20,25 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | ||
| 24 | #if defined(__GNUC__) | ||
| 25 | #define HAVE_BN_UMUL_HILO | ||
| 26 | |||
| 27 | static inline void | ||
| 28 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | ||
| 29 | { | ||
| 30 | BN_ULONG h, l; | ||
| 31 | |||
| 32 | /* Unsigned multiplication using a umulh/mulq pair. */ | ||
| 33 | __asm__ ("umulh %2, %3, %0; mulq %2, %3, %1" | ||
| 34 | : "=r"(h), "=r"(l) | ||
| 35 | : "r"(a), "r"(b)); | ||
| 36 | |||
| 37 | *out_h = h; | ||
| 38 | *out_l = l; | ||
| 39 | } | ||
| 40 | #endif /* __GNUC__ */ | ||
| 41 | #endif | ||
| 42 | |||
| 23 | #endif | 43 | #endif |
| 24 | #endif | 44 | #endif |
diff --git a/src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h b/src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h index 4d6571f9cb..1b8bd61138 100644 --- a/src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.1 2023/01/20 10:04:34 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.2 2023/01/31 05:57:08 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,5 +20,25 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | ||
| 24 | #if defined(__GNUC__) | ||
| 25 | #define HAVE_BN_UMUL_HILO | ||
| 26 | |||
| 27 | static inline void | ||
| 28 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | ||
| 29 | { | ||
| 30 | BN_ULONG h, l; | ||
| 31 | |||
| 32 | /* Unsigned multiplication using a mulhdu/mul pair. */ | ||
| 33 | __asm__ ("mulhdu %0, %2, %3; mul %1, %2, %3" | ||
| 34 | : "=r"(h), "=r"(l) | ||
| 35 | : "r"(a), "r"(b)); | ||
| 36 | |||
| 37 | *out_h = h; | ||
| 38 | *out_l = l; | ||
| 39 | } | ||
| 40 | #endif /* __GNUC__ */ | ||
| 41 | #endif | ||
| 42 | |||
| 23 | #endif | 43 | #endif |
| 24 | #endif | 44 | #endif |
diff --git a/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h b/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h index 4d6571f9cb..1b4267acc0 100644 --- a/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.1 2023/01/20 10:04:34 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.2 2023/01/31 05:57:08 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,5 +20,29 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | ||
| 24 | #if defined(__GNUC__) | ||
| 25 | #define HAVE_BN_UMUL_HILO | ||
| 26 | |||
| 27 | static inline void | ||
| 28 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | ||
| 29 | { | ||
| 30 | BN_ULONG h, l; | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Unsigned multiplication using a mulh/mul pair. Note that the order | ||
| 34 | * of these instructions is important, as they can potentially be fused | ||
| 35 | * into a single operation. | ||
| 36 | */ | ||
| 37 | __asm__ ("mulh %0, %2, %3; mul %1, %2, %3" | ||
| 38 | : "=r"(h), "=r"(l) | ||
| 39 | : "r"(a), "r"(b)); | ||
| 40 | |||
| 41 | *out_h = h; | ||
| 42 | *out_l = l; | ||
| 43 | } | ||
| 44 | #endif /* __GNUC__ */ | ||
| 45 | #endif | ||
| 46 | |||
| 23 | #endif | 47 | #endif |
| 24 | #endif | 48 | #endif |
