| @@ -8,12 +8,9 @@ | |||||
| #include <assert.h> | #include <assert.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "decaf/decaf_255.h" | |||||
| #include "word.h" | #include "word.h" | ||||
| typedef struct gf_25519_s { | |||||
| uint64_t limb[5]; | |||||
| } gf_25519_s, gf_25519_t[1]; | |||||
| #define LBITS 51 | #define LBITS 51 | ||||
| #define FIELD_LITERAL(a,b,c,d,e) {{ a,b,c,d,e }} | #define FIELD_LITERAL(a,b,c,d,e) {{ a,b,c,d,e }} | ||||
| @@ -8,15 +8,9 @@ | |||||
| #include <assert.h> | #include <assert.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "decaf/decaf_255.h" | |||||
| #include "word.h" | #include "word.h" | ||||
| #ifndef __DECAF_255_H__ // HACK FIXME | |||||
| #define DECAF_WORD_BITS 64 | |||||
| typedef struct gf_25519_s { | |||||
| uint64_t limb[5]; | |||||
| } gf_25519_s, gf_25519_t[1]; | |||||
| #endif | |||||
| #define LBITS 51 | #define LBITS 51 | ||||
| #define FIELD_LITERAL(a,b,c,d,e) {{ a,b,c,d,e }} | #define FIELD_LITERAL(a,b,c,d,e) {{ a,b,c,d,e }} | ||||
| @@ -21,13 +21,14 @@ extern "C" { | |||||
| #define DECAF_255_SCALAR_BITS 254 // Curve25519: 253 | #define DECAF_255_SCALAR_BITS 254 // Curve25519: 253 | ||||
| #define DECAF_255_SCALAR_LIMBS (256/DECAF_WORD_BITS) | #define DECAF_255_SCALAR_LIMBS (256/DECAF_WORD_BITS) | ||||
| #ifndef __DECAF_GF_ALREADY_DEFINED__ | |||||
| #ifndef __DECAF_255_GF_DEFINED__ | |||||
| #define __DECAF_255_GF_DEFINED__ 1 | |||||
| /** Galois field element internal structure */ | /** Galois field element internal structure */ | ||||
| typedef struct gf_25519_s { | typedef struct gf_25519_s { | ||||
| decaf_word_t limb[DECAF_255_LIMBS]; | decaf_word_t limb[DECAF_255_LIMBS]; | ||||
| } gf_25519_s, gf_25519_t[1]; | } gf_25519_s, gf_25519_t[1]; | ||||
| /** @endcond */ | /** @endcond */ | ||||
| #endif /* __DECAF_GF_ALREADY_DEFINED__ */ | |||||
| #endif /* __DECAF_255_GF_DEFINED__ */ | |||||
| /** Number of bytes in a serialized point. */ | /** Number of bytes in a serialized point. */ | ||||
| #define DECAF_255_SER_BYTES 32 | #define DECAF_255_SER_BYTES 32 | ||||
| @@ -22,9 +22,12 @@ extern "C" { | |||||
| #define DECAF_448_SCALAR_LIMBS (448/DECAF_WORD_BITS) | #define DECAF_448_SCALAR_LIMBS (448/DECAF_WORD_BITS) | ||||
| /** Galois field element internal structure */ | /** Galois field element internal structure */ | ||||
| #ifndef __DECAF_448_GF_DEFINED__ | |||||
| #define __DECAF_448_GF_DEFINED__ 1 | |||||
| typedef struct gf_448_s { | typedef struct gf_448_s { | ||||
| decaf_word_t limb[DECAF_448_LIMBS]; | decaf_word_t limb[DECAF_448_LIMBS]; | ||||
| } __attribute__((aligned(32))) gf_448_s, gf_448_t[1]; | } __attribute__((aligned(32))) gf_448_s, gf_448_t[1]; | ||||
| #endif /* __DECAF_448_GF_DEFINED__ */ | |||||
| /** @endcond */ | /** @endcond */ | ||||
| /** Number of bytes in a serialized point. */ | /** Number of bytes in a serialized point. */ | ||||