diff options
| author | jsing <> | 2023-02-16 10:41:03 +0000 |
|---|---|---|
| committer | jsing <> | 2023-02-16 10:41:03 +0000 |
| commit | d3699a732b869a27d4edac40e74816362ea9be8a (patch) | |
| tree | 1567d4016a24536bb2e57960203cb4c640cd41e3 /src/lib/libcrypto/bn/arch | |
| parent | 86621357e60f9e67b9a598c67567b92aeaead6ba (diff) | |
| download | openbsd-d3699a732b869a27d4edac40e74816362ea9be8a.tar.gz openbsd-d3699a732b869a27d4edac40e74816362ea9be8a.tar.bz2 openbsd-d3699a732b869a27d4edac40e74816362ea9be8a.zip | |
Rename bn_umul_hilo() to bn_mulw().
This keeps the naming consistent with the other bignum primitives that have
been recently introduced. Also, use 1/0 intead of h/l (e.g. a1 instead of
ah), as this keeps consistency with other primitives and allows for naming
that works with double word, triple word and quadruple word inputs/outputs.
Discussed with tb@
Diffstat (limited to 'src/lib/libcrypto/bn/arch')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/aarch64/bn_arch.h | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/alpha/bn_arch.h | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bn_arch.h | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/i386/bn_arch.h | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/riscv64/bn_arch.h | 14 |
6 files changed, 42 insertions, 42 deletions
diff --git a/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h b/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h index 7592971dc0..cc456848c9 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.3 2023/02/04 11:48:55 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.4 2023/02/16 10:41:03 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -23,20 +23,20 @@ | |||
| 23 | #ifndef OPENSSL_NO_ASM | 23 | #ifndef OPENSSL_NO_ASM |
| 24 | 24 | ||
| 25 | #if defined(__GNUC__) | 25 | #if defined(__GNUC__) |
| 26 | #define HAVE_BN_UMUL_HILO | 26 | #define HAVE_BN_MULW |
| 27 | 27 | ||
| 28 | static inline void | 28 | static inline void |
| 29 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | 29 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 30 | { | 30 | { |
| 31 | BN_ULONG h, l; | 31 | BN_ULONG r1, r0; |
| 32 | 32 | ||
| 33 | /* Unsigned multiplication using a umulh/mul pair. */ | 33 | /* Unsigned multiplication using a umulh/mul pair. */ |
| 34 | __asm__ ("umulh %0, %2, %3; mul %1, %2, %3" | 34 | __asm__ ("umulh %0, %2, %3; mul %1, %2, %3" |
| 35 | : "=&r"(h), "=r"(l) | 35 | : "=&r"(r1), "=r"(r0) |
| 36 | : "r"(a), "r"(b)); | 36 | : "r"(a), "r"(b)); |
| 37 | 37 | ||
| 38 | *out_h = h; | 38 | *out_r1 = r1; |
| 39 | *out_l = l; | 39 | *out_r0 = r0; |
| 40 | } | 40 | } |
| 41 | #endif /* __GNUC__ */ | 41 | #endif /* __GNUC__ */ |
| 42 | 42 | ||
diff --git a/src/lib/libcrypto/bn/arch/alpha/bn_arch.h b/src/lib/libcrypto/bn/arch/alpha/bn_arch.h index 0f7c582fdf..5bf4ba8722 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.3 2023/02/04 11:48:55 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.4 2023/02/16 10:41:03 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,20 +22,20 @@ | |||
| 22 | 22 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | 23 | #if 0 /* Needs testing and enabling. */ |
| 24 | #if defined(__GNUC__) | 24 | #if defined(__GNUC__) |
| 25 | #define HAVE_BN_UMUL_HILO | 25 | #define HAVE_BN_MULW |
| 26 | 26 | ||
| 27 | static inline void | 27 | static inline void |
| 28 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | 28 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 29 | { | 29 | { |
| 30 | BN_ULONG h, l; | 30 | BN_ULONG r1, r0; |
| 31 | 31 | ||
| 32 | /* Unsigned multiplication using a umulh/mulq pair. */ | 32 | /* Unsigned multiplication using a umulh/mulq pair. */ |
| 33 | __asm__ ("umulh %2, %3, %0; mulq %2, %3, %1" | 33 | __asm__ ("umulh %2, %3, %0; mulq %2, %3, %1" |
| 34 | : "=&r"(h), "=r"(l) | 34 | : "=&r"(r1), "=r"(r0) |
| 35 | : "r"(a), "r"(b)); | 35 | : "r"(a), "r"(b)); |
| 36 | 36 | ||
| 37 | *out_h = h; | 37 | *out_r1 = r1; |
| 38 | *out_l = l; | 38 | *out_r0 = r0; |
| 39 | } | 39 | } |
| 40 | #endif /* __GNUC__ */ | 40 | #endif /* __GNUC__ */ |
| 41 | #endif | 41 | #endif |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h index 637903077a..80f73bf15f 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.11 2023/02/04 14:00:18 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.12 2023/02/16 10:41:03 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -63,24 +63,24 @@ bn_div_rem_words_inline(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q, | |||
| 63 | #endif /* __GNUC__ */ | 63 | #endif /* __GNUC__ */ |
| 64 | 64 | ||
| 65 | #if defined(__GNUC__) | 65 | #if defined(__GNUC__) |
| 66 | #define HAVE_BN_UMUL_HILO | 66 | #define HAVE_BN_MULW |
| 67 | 67 | ||
| 68 | static inline void | 68 | static inline void |
| 69 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | 69 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 70 | { | 70 | { |
| 71 | BN_ULONG h, l; | 71 | BN_ULONG r1, r0; |
| 72 | 72 | ||
| 73 | /* | 73 | /* |
| 74 | * Unsigned multiplication of %rax, with the double word result being | 74 | * Unsigned multiplication of %rax, with the double word result being |
| 75 | * stored in %rdx:%rax. | 75 | * stored in %rdx:%rax. |
| 76 | */ | 76 | */ |
| 77 | __asm__ ("mulq %3" | 77 | __asm__ ("mulq %3" |
| 78 | : "=d"(h), "=a"(l) | 78 | : "=d"(r1), "=a"(r0) |
| 79 | : "a"(a), "rm"(b) | 79 | : "a"(a), "rm"(b) |
| 80 | : "cc"); | 80 | : "cc"); |
| 81 | 81 | ||
| 82 | *out_h = h; | 82 | *out_r1 = r1; |
| 83 | *out_l = l; | 83 | *out_r0 = r0; |
| 84 | } | 84 | } |
| 85 | #endif /* __GNUC__ */ | 85 | #endif /* __GNUC__ */ |
| 86 | 86 | ||
diff --git a/src/lib/libcrypto/bn/arch/i386/bn_arch.h b/src/lib/libcrypto/bn/arch/i386/bn_arch.h index 268c51e41a..eef519fcc7 100644 --- a/src/lib/libcrypto/bn/arch/i386/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/i386/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.8 2023/01/31 05:53:49 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.9 2023/02/16 10:41:03 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -61,24 +61,24 @@ bn_div_rem_words_inline(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q, | |||
| 61 | #endif /* __GNUC__ */ | 61 | #endif /* __GNUC__ */ |
| 62 | 62 | ||
| 63 | #if defined(__GNUC__) | 63 | #if defined(__GNUC__) |
| 64 | #define HAVE_BN_UMUL_HILO | 64 | #define HAVE_BN_MULW |
| 65 | 65 | ||
| 66 | static inline void | 66 | static inline void |
| 67 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | 67 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 68 | { | 68 | { |
| 69 | BN_ULONG h, l; | 69 | BN_ULONG r1, r0; |
| 70 | 70 | ||
| 71 | /* | 71 | /* |
| 72 | * Unsigned multiplication of %eax, with the double word result being | 72 | * Unsigned multiplication of %eax, with the double word result being |
| 73 | * stored in %edx:%eax. | 73 | * stored in %edx:%eax. |
| 74 | */ | 74 | */ |
| 75 | __asm__ ("mull %3" | 75 | __asm__ ("mull %3" |
| 76 | : "=d"(h), "=a"(l) | 76 | : "=d"(r1), "=a"(r0) |
| 77 | : "a"(a), "rm"(b) | 77 | : "a"(a), "rm"(b) |
| 78 | : "cc"); | 78 | : "cc"); |
| 79 | 79 | ||
| 80 | *out_h = h; | 80 | *out_r1 = r1; |
| 81 | *out_l = l; | 81 | *out_r0 = r0; |
| 82 | } | 82 | } |
| 83 | #endif /* __GNUC__ */ | 83 | #endif /* __GNUC__ */ |
| 84 | 84 | ||
diff --git a/src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h b/src/lib/libcrypto/bn/arch/powerpc64/bn_arch.h index 92e16e9f9c..18bac203eb 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.3 2023/02/04 11:48:55 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.4 2023/02/16 10:41:03 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,20 +22,20 @@ | |||
| 22 | 22 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | 23 | #if 0 /* Needs testing and enabling. */ |
| 24 | #if defined(__GNUC__) | 24 | #if defined(__GNUC__) |
| 25 | #define HAVE_BN_UMUL_HILO | 25 | #define HAVE_BN_MULW |
| 26 | 26 | ||
| 27 | static inline void | 27 | static inline void |
| 28 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | 28 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 29 | { | 29 | { |
| 30 | BN_ULONG h, l; | 30 | BN_ULONG r1, r0; |
| 31 | 31 | ||
| 32 | /* Unsigned multiplication using a mulhdu/mul pair. */ | 32 | /* Unsigned multiplication using a mulhdu/mul pair. */ |
| 33 | __asm__ ("mulhdu %0, %2, %3; mul %1, %2, %3" | 33 | __asm__ ("mulhdu %0, %2, %3; mul %1, %2, %3" |
| 34 | : "=&r"(h), "=r"(l) | 34 | : "=&r"(r1), "=r"(r0) |
| 35 | : "r"(a), "r"(b)); | 35 | : "r"(a), "r"(b)); |
| 36 | 36 | ||
| 37 | *out_h = h; | 37 | *out_r1 = r1; |
| 38 | *out_l = l; | 38 | *out_r0 = r0; |
| 39 | } | 39 | } |
| 40 | #endif /* __GNUC__ */ | 40 | #endif /* __GNUC__ */ |
| 41 | #endif | 41 | #endif |
diff --git a/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h b/src/lib/libcrypto/bn/arch/riscv64/bn_arch.h index 36cf3a4f66..354774cde3 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.3 2023/02/04 11:48:55 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.4 2023/02/16 10:41:03 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,12 +22,12 @@ | |||
| 22 | 22 | ||
| 23 | #if 0 /* Needs testing and enabling. */ | 23 | #if 0 /* Needs testing and enabling. */ |
| 24 | #if defined(__GNUC__) | 24 | #if defined(__GNUC__) |
| 25 | #define HAVE_BN_UMUL_HILO | 25 | #define HAVE_BN_MULW |
| 26 | 26 | ||
| 27 | static inline void | 27 | static inline void |
| 28 | bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | 28 | bn_mulw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_r1, BN_ULONG *out_r0) |
| 29 | { | 29 | { |
| 30 | BN_ULONG h, l; | 30 | BN_ULONG r1, r0; |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| 33 | * Unsigned multiplication using a mulh/mul pair. Note that the order | 33 | * Unsigned multiplication using a mulh/mul pair. Note that the order |
| @@ -35,11 +35,11 @@ bn_umul_hilo(BN_ULONG a, BN_ULONG b, BN_ULONG *out_h, BN_ULONG *out_l) | |||
| 35 | * into a single operation. | 35 | * into a single operation. |
| 36 | */ | 36 | */ |
| 37 | __asm__ ("mulh %0, %2, %3; mul %1, %2, %3" | 37 | __asm__ ("mulh %0, %2, %3; mul %1, %2, %3" |
| 38 | : "=&r"(h), "=r"(l) | 38 | : "=&r"(r1), "=r"(r0) |
| 39 | : "r"(a), "r"(b)); | 39 | : "r"(a), "r"(b)); |
| 40 | 40 | ||
| 41 | *out_h = h; | 41 | *out_r1 = r1; |
| 42 | *out_l = l; | 42 | *out_r0 = r0; |
| 43 | } | 43 | } |
| 44 | #endif /* __GNUC__ */ | 44 | #endif /* __GNUC__ */ |
| 45 | #endif | 45 | #endif |
