@@ -28,13 +28,13 @@ | |||||
#define hash_destroy decaf_sha512_destroy | #define hash_destroy decaf_sha512_destroy | ||||
#define hash_hash decaf_sha512_hash | #define hash_hash decaf_sha512_hash | ||||
#define NO_CONTEXT DECAF_EDDSA_25519_NO_CONTEXT | |||||
#define NO_CONTEXT DECAF_EDDSA_25519_SUPPORTS_CONTEXTLESS_SIGS | |||||
#define EDDSA_USE_SIGMA_ISOGENY 1 | #define EDDSA_USE_SIGMA_ISOGENY 1 | ||||
#define COFACTOR 8 | #define COFACTOR 8 | ||||
#if NO_CONTEXT | #if NO_CONTEXT | ||||
const uint8_t NO_CONTEXT_POINTS_HERE = 0; | const uint8_t NO_CONTEXT_POINTS_HERE = 0; | ||||
const uint8_t * const ED25519_NO_CONTEXT = &NO_CONTEXT_POINTS_HERE; | |||||
const uint8_t * const DECAF_ED25519_NO_CONTEXT = &NO_CONTEXT_POINTS_HERE; | |||||
#endif | #endif | ||||
/* EDDSA_BASE_POINT_RATIO = 1 or 2 | /* EDDSA_BASE_POINT_RATIO = 1 or 2 | ||||
@@ -68,7 +68,7 @@ static void hash_init_with_dom( | |||||
hash_init(hash); | hash_init(hash); | ||||
#if NO_CONTEXT | #if NO_CONTEXT | ||||
if (context_len == 0 && context == ED25519_NO_CONTEXT) { | |||||
if (context_len == 0 && context == DECAF_ED25519_NO_CONTEXT) { | |||||
(void)prehashed; | (void)prehashed; | ||||
(void)for_prehash; | (void)for_prehash; | ||||
(void)context; | (void)context; | ||||
@@ -28,13 +28,13 @@ | |||||
#define hash_destroy decaf_shake256_destroy | #define hash_destroy decaf_shake256_destroy | ||||
#define hash_hash decaf_shake256_hash | #define hash_hash decaf_shake256_hash | ||||
#define NO_CONTEXT DECAF_EDDSA_448_NO_CONTEXT | |||||
#define NO_CONTEXT DECAF_EDDSA_448_SUPPORTS_CONTEXTLESS_SIGS | |||||
#define EDDSA_USE_SIGMA_ISOGENY 0 | #define EDDSA_USE_SIGMA_ISOGENY 0 | ||||
#define COFACTOR 4 | #define COFACTOR 4 | ||||
#if NO_CONTEXT | #if NO_CONTEXT | ||||
const uint8_t NO_CONTEXT_POINTS_HERE = 0; | const uint8_t NO_CONTEXT_POINTS_HERE = 0; | ||||
const uint8_t * const ED448_NO_CONTEXT = &NO_CONTEXT_POINTS_HERE; | |||||
const uint8_t * const DECAF_ED448_NO_CONTEXT = &NO_CONTEXT_POINTS_HERE; | |||||
#endif | #endif | ||||
/* EDDSA_BASE_POINT_RATIO = 1 or 2 | /* EDDSA_BASE_POINT_RATIO = 1 or 2 | ||||
@@ -68,7 +68,7 @@ static void hash_init_with_dom( | |||||
hash_init(hash); | hash_init(hash); | ||||
#if NO_CONTEXT | #if NO_CONTEXT | ||||
if (context_len == 0 && context == ED448_NO_CONTEXT) { | |||||
if (context_len == 0 && context == DECAF_ED448_NO_CONTEXT) { | |||||
(void)prehashed; | (void)prehashed; | ||||
(void)for_prehash; | (void)for_prehash; | ||||
(void)context; | (void)context; | ||||
@@ -33,8 +33,8 @@ extern "C" { | |||||
#define DECAF_EDDSA_25519_SIGNATURE_BYTES (DECAF_EDDSA_25519_PUBLIC_BYTES + DECAF_EDDSA_25519_PRIVATE_BYTES) | #define DECAF_EDDSA_25519_SIGNATURE_BYTES (DECAF_EDDSA_25519_PUBLIC_BYTES + DECAF_EDDSA_25519_PRIVATE_BYTES) | ||||
/** Does EdDSA support non-contextual signatures? */ | /** Does EdDSA support non-contextual signatures? */ | ||||
#define DECAF_EDDSA_25519_NO_CONTEXT 1 | |||||
extern const uint8_t * const ED25519_NO_CONTEXT API_VIS; | |||||
#define DECAF_EDDSA_25519_SUPPORTS_CONTEXTLESS_SIGS 1 | |||||
extern const uint8_t * const DECAF_ED25519_NO_CONTEXT API_VIS; | |||||
/** Prehash context renaming macros. */ | /** Prehash context renaming macros. */ | ||||
#define decaf_ed25519_prehash_ctx_s decaf_sha512_ctx_s | #define decaf_ed25519_prehash_ctx_s decaf_sha512_ctx_s | ||||
@@ -56,8 +56,8 @@ typedef class PublicKeyBase PublicKey, PublicKeyPure, PublicKeyPh; | |||||
/** @endcond */ | /** @endcond */ | ||||
#if DECAF_EDDSA_25519_NO_CONTEXT | |||||
static inline const Block NO_CONTEXT() { return Block(ED25519_NO_CONTEXT,0); } | |||||
#if DECAF_EDDSA_25519_SUPPORTS_CONTEXTLESS_SIGS | |||||
static inline const Block NO_CONTEXT() { return Block(DECAF_ED25519_NO_CONTEXT,0); } | |||||
#else | #else | ||||
static inline const Block NO_CONTEXT() { return Block(NULL,0); } | static inline const Block NO_CONTEXT() { return Block(NULL,0); } | ||||
#endif | #endif | ||||
@@ -33,7 +33,7 @@ extern "C" { | |||||
#define DECAF_EDDSA_448_SIGNATURE_BYTES (DECAF_EDDSA_448_PUBLIC_BYTES + DECAF_EDDSA_448_PRIVATE_BYTES) | #define DECAF_EDDSA_448_SIGNATURE_BYTES (DECAF_EDDSA_448_PUBLIC_BYTES + DECAF_EDDSA_448_PRIVATE_BYTES) | ||||
/** Does EdDSA support non-contextual signatures? */ | /** Does EdDSA support non-contextual signatures? */ | ||||
#define DECAF_EDDSA_448_NO_CONTEXT 0 | |||||
#define DECAF_EDDSA_448_SUPPORTS_CONTEXTLESS_SIGS 0 | |||||
/** Prehash context renaming macros. */ | /** Prehash context renaming macros. */ | ||||
#define decaf_ed448_prehash_ctx_s decaf_shake256_ctx_s | #define decaf_ed448_prehash_ctx_s decaf_shake256_ctx_s | ||||
@@ -56,8 +56,8 @@ typedef class PublicKeyBase PublicKey, PublicKeyPure, PublicKeyPh; | |||||
/** @endcond */ | /** @endcond */ | ||||
#if DECAF_EDDSA_448_NO_CONTEXT | |||||
static inline const Block NO_CONTEXT() { return Block(ED448_NO_CONTEXT,0); } | |||||
#if DECAF_EDDSA_448_SUPPORTS_CONTEXTLESS_SIGS | |||||
static inline const Block NO_CONTEXT() { return Block(DECAF_ED448_NO_CONTEXT,0); } | |||||
#else | #else | ||||
static inline const Block NO_CONTEXT() { return Block(NULL,0); } | static inline const Block NO_CONTEXT() { return Block(NULL,0); } | ||||
#endif | #endif | ||||
@@ -19,13 +19,13 @@ | |||||
#define hash_destroy decaf_$(eddsa_hash)_destroy | #define hash_destroy decaf_$(eddsa_hash)_destroy | ||||
#define hash_hash decaf_$(eddsa_hash)_hash | #define hash_hash decaf_$(eddsa_hash)_hash | ||||
#define NO_CONTEXT DECAF_EDDSA_$(gf_shortname)_NO_CONTEXT | |||||
#define NO_CONTEXT DECAF_EDDSA_$(gf_shortname)_SUPPORTS_CONTEXTLESS_SIGS | |||||
#define EDDSA_USE_SIGMA_ISOGENY $(eddsa_sigma_iso) | #define EDDSA_USE_SIGMA_ISOGENY $(eddsa_sigma_iso) | ||||
#define COFACTOR $(cofactor) | #define COFACTOR $(cofactor) | ||||
#if NO_CONTEXT | #if NO_CONTEXT | ||||
const uint8_t NO_CONTEXT_POINTS_HERE = 0; | const uint8_t NO_CONTEXT_POINTS_HERE = 0; | ||||
$("const uint8_t * const ED" + gf_shortname + "_NO_CONTEXT") = &NO_CONTEXT_POINTS_HERE; | |||||
const uint8_t * const DECAF_ED$(gf_shortname)_NO_CONTEXT = &NO_CONTEXT_POINTS_HERE; | |||||
#endif | #endif | ||||
/* EDDSA_BASE_POINT_RATIO = 1 or 2 | /* EDDSA_BASE_POINT_RATIO = 1 or 2 | ||||
@@ -59,7 +59,7 @@ static void hash_init_with_dom( | |||||
hash_init(hash); | hash_init(hash); | ||||
#if NO_CONTEXT | #if NO_CONTEXT | ||||
if (context_len == 0 && context == ED$(gf_shortname)_NO_CONTEXT) { | |||||
if (context_len == 0 && context == DECAF_ED$(gf_shortname)_NO_CONTEXT) { | |||||
(void)prehashed; | (void)prehashed; | ||||
(void)for_prehash; | (void)for_prehash; | ||||
(void)context; | (void)context; | ||||
@@ -18,8 +18,8 @@ extern "C" { | |||||
#define DECAF_EDDSA_$(gf_shortname)_SIGNATURE_BYTES (DECAF_EDDSA_$(gf_shortname)_PUBLIC_BYTES + DECAF_EDDSA_$(gf_shortname)_PRIVATE_BYTES) | #define DECAF_EDDSA_$(gf_shortname)_SIGNATURE_BYTES (DECAF_EDDSA_$(gf_shortname)_PUBLIC_BYTES + DECAF_EDDSA_$(gf_shortname)_PRIVATE_BYTES) | ||||
/** Does EdDSA support non-contextual signatures? */ | /** Does EdDSA support non-contextual signatures? */ | ||||
#define DECAF_EDDSA_$(gf_shortname)_NO_CONTEXT $(eddsa_no_context) | |||||
$("extern const uint8_t * const ED" + gf_shortname + "_NO_CONTEXT API_VIS;\n" if eddsa_no_context else "") | |||||
#define DECAF_EDDSA_$(gf_shortname)_SUPPORTS_CONTEXTLESS_SIGS $(eddsa_no_context) | |||||
$("extern const uint8_t * const DECAF_ED" + gf_shortname + "_NO_CONTEXT API_VIS;\n" if eddsa_no_context else "") | |||||
/** Prehash context renaming macros. */ | /** Prehash context renaming macros. */ | ||||
#define decaf_ed$(gf_shortname)_prehash_ctx_s decaf_$(eddsa_hash)_ctx_s | #define decaf_ed$(gf_shortname)_prehash_ctx_s decaf_$(eddsa_hash)_ctx_s | ||||
#define decaf_ed$(gf_shortname)_prehash_ctx_t decaf_$(eddsa_hash)_ctx_t | #define decaf_ed$(gf_shortname)_prehash_ctx_t decaf_$(eddsa_hash)_ctx_t | ||||
@@ -40,8 +40,8 @@ typedef class PublicKeyBase PublicKey, PublicKeyPure, PublicKeyPh; | |||||
/** @endcond */ | /** @endcond */ | ||||
#if DECAF_EDDSA_$(gf_shortname)_NO_CONTEXT | |||||
static inline const Block NO_CONTEXT() { return Block(ED$(gf_shortname)_NO_CONTEXT,0); } | |||||
#if DECAF_EDDSA_$(gf_shortname)_SUPPORTS_CONTEXTLESS_SIGS | |||||
static inline const Block NO_CONTEXT() { return Block(DECAF_ED$(gf_shortname)_NO_CONTEXT,0); } | |||||
#else | #else | ||||
static inline const Block NO_CONTEXT() { return Block(NULL,0); } | static inline const Block NO_CONTEXT() { return Block(NULL,0); } | ||||
#endif | #endif | ||||
@@ -507,9 +507,9 @@ template<> const Block Tests<IsoEd25519>::eddsa_pk[] = { | |||||
Block(ed25519_eddsa_pk[4],32) | Block(ed25519_eddsa_pk[4],32) | ||||
}; | }; | ||||
template<> const Block Tests<IsoEd25519>::eddsa_context[] = { | template<> const Block Tests<IsoEd25519>::eddsa_context[] = { | ||||
Block(ED25519_NO_CONTEXT,0), | |||||
Block(ED25519_NO_CONTEXT,0), | |||||
Block(ED25519_NO_CONTEXT,0), | |||||
EdDSA<IsoEd25519>::NO_CONTEXT(), | |||||
EdDSA<IsoEd25519>::NO_CONTEXT(), | |||||
EdDSA<IsoEd25519>::NO_CONTEXT(), | |||||
Block(NULL,0), | Block(NULL,0), | ||||
Block(ed25519_eddsa_context[0],3), | Block(ed25519_eddsa_context[0],3), | ||||
Block(ed25519_eddsa_context[1],3) | Block(ed25519_eddsa_context[1],3) | ||||