diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/riscv64/bn_arch.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h b/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h index 354774cde3..66256acad0 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.4 2023/02/16 10:41:03 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.5 2023/07/07 16:10:32 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,15 +15,17 @@ | |||
| 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 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | ||
| 24 | #if defined(__GNUC__) | 25 | #if defined(__GNUC__) |
| 25 | #define HAVE_BN_MULW | ||
| 26 | 26 | ||
| 27 | #define HAVE_BN_MULW | ||
| 28 | |||
| 27 | static inline void | 29 | static inline void |
| 28 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) | 30 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 29 | { | 31 | { |
| @@ -34,15 +36,17 @@ bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) | |||
| 34 | * of these instructions is important, as they can potentially be fused | 36 | * of these instructions is important, as they can potentially be fused |
| 35 | * into a single operation. | 37 | * into a single operation. |
| 36 | */ | 38 | */ |
| 37 | __asm__ ("mulh %0, %2, %3; mul %1, %2, %3" | 39 | __asm__ ( |
| 38 | : "=&r"(r1), "=r"(r0) | 40 | "mulhu %[r1], %[a], %[b] \n" |
| 39 | : "r"(a), "r"(b)); | 41 | "mul %[r0], %[a], %[b] \n" |
| 42 | : [r1]"=&r"(r1), [r0]"=r"(r0) | ||
| 43 | : [a]"r"(a), [b]"r"(b)); | ||
| 40 | 44 | ||
| 41 | *out_r1 = r1; | 45 | *out_r1 = r1; |
| 42 | *out_r0 = r0; | 46 | *out_r0 = r0; |
| 43 | } | 47 | } |
| 48 | |||
| 44 | #endif /* __GNUC__ */ | 49 | #endif /* __GNUC__ */ |
| 45 | #endif | ||
| 46 | 50 | ||
| 47 | #endif | 51 | #endif |
| 48 | #endif | 52 | #endif |
