diff options
author | Amitay Isaacs <amitay@ozlabs.org> | 2021-01-19 14:14:25 +1100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-04-08 12:18:10 +0100 |
commit | 27947123c9f17deac005b2afd265e38903349918 (patch) | |
tree | ff23562526abb5167653d1070f4d37458234908c /crypto/ec/curve448 | |
parent | a72da9ecebcd8e9b9caf6a3d05251a7008e9c614 (diff) |
curve448: Integrate 64-bit reference implementation
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)
Diffstat (limited to 'crypto/ec/curve448')
-rw-r--r-- | crypto/ec/curve448/arch_64/f_impl.c | 2 | ||||
-rw-r--r-- | crypto/ec/curve448/field.h | 9 | ||||
-rw-r--r-- | crypto/ec/curve448/word.h | 7 |
3 files changed, 14 insertions, 4 deletions
diff --git a/crypto/ec/curve448/arch_64/f_impl.c b/crypto/ec/curve448/arch_64/f_impl.c index 955f723419..2b428cd686 100644 --- a/crypto/ec/curve448/arch_64/f_impl.c +++ b/crypto/ec/curve448/arch_64/f_impl.c @@ -10,7 +10,7 @@ * Originally written by Mike Hamburg */ -#include "field.h" +#include "../field.h" void gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs) { diff --git a/crypto/ec/curve448/field.h b/crypto/ec/curve448/field.h index 71349e45a1..4f69c0bdd8 100644 --- a/crypto/ec/curve448/field.h +++ b/crypto/ec/curve448/field.h @@ -66,10 +66,15 @@ void gf_serialize(uint8_t *serial, const gf x, int with_highbit); mask_t gf_deserialize(gf x, const uint8_t serial[SER_BYTES], int with_hibit, uint8_t hi_nmask); -# include "arch_32/f_impl.h" /* Bring in the inline implementations */ # define LIMBPERM(i) (i) -# define LIMB_MASK(i) (((1)<<LIMB_PLACE_VALUE(i))-1) +# if (ARCH_WORD_BITS == 32) +# include "arch_32/f_impl.h" /* Bring in the inline implementations */ +# define LIMB_MASK(i) (((1)<<LIMB_PLACE_VALUE(i))-1) +# elif (ARCH_WORD_BITS == 64) +# include "arch_64/f_impl.h" /* Bring in the inline implementations */ +# define LIMB_MASK(i) (((1ULL)<<LIMB_PLACE_VALUE(i))-1) +# endif static const gf ZERO = {{{0}}}, ONE = {{{1}}}; diff --git a/crypto/ec/curve448/word.h b/crypto/ec/curve448/word.h index 06555cf329..f94f086fa9 100644 --- a/crypto/ec/curve448/word.h +++ b/crypto/ec/curve448/word.h @@ -17,9 +17,14 @@ # include <assert.h> # include <stdlib.h> # include <openssl/e_os2.h> -# include "arch_32/arch_intrinsics.h" # include "curve448utils.h" +# ifdef INT128_MAX +# include "arch_64/arch_intrinsics.h" +# else +# include "arch_32/arch_intrinsics.h" +# endif + # if (ARCH_WORD_BITS == 64) typedef uint64_t word_t, mask_t; typedef uint128_t dword_t; |