diff options
author | Amitay Isaacs <amitay@ozlabs.org> | 2020-10-13 05:11:40 -0400 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-05-29 16:07:15 +1000 |
commit | 30691da1ba465f3cff5d865187fbf5c5244448eb (patch) | |
tree | 5f6411cf88386caa2f26051e8e6a6f9554024c4d /crypto/ec/ecp_nistp521.c | |
parent | 1036749883ccf38ed11afe424d69708cfdca99f3 (diff) |
ec: Add PPC64 vector assembly version of p521 field operations
Only field multiplication and squaring (but not reduction) show a
significant improvement. This is enabled on Power ISA >= 3.0.
On a Power 9 CPU an average 10% performance improvement is seen (ECHDE:
14%, ECDSA sign: 6%, ECDSA verify 10%), compared to existing code.
On an upcoming Power 10 CPU we see an average performance improvement
of 26% (ECHDE: 38%, ECDSA sign: 16%, ECDSA verify 25%), compared to
existing code.
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15401)
Diffstat (limited to 'crypto/ec/ecp_nistp521.c')
-rw-r--r-- | crypto/ec/ecp_nistp521.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c index 02bded2b6f..338618ebca 100644 --- a/crypto/ec/ecp_nistp521.c +++ b/crypto/ec/ecp_nistp521.c @@ -684,8 +684,24 @@ static void (*felem_square_p)(largefelem out, const felem in) = static void (*felem_mul_p)(largefelem out, const felem in1, const felem in2) = felem_mul_wrapper; +void p521_felem_square(largefelem out, const felem in); +void p521_felem_mul(largefelem out, const felem in1, const felem in2); + +# if defined(_ARCH_PPC64) +# include "ppc_arch.h" +# endif + void felem_select(void) { +# if defined(_ARCH_PPC64) + if ((OPENSSL_ppccap_P & PPC_MADD300) && (OPENSSL_ppccap_P & PPC_ALTIVEC)) { + felem_square_p = p521_felem_square; + felem_mul_p = p521_felem_mul; + + return; + } +# endif + /* Default */ felem_square_p = felem_square_ref; felem_mul_p = felem_mul_ref; |