From 875d2b225118ad1560ac6edca6cb23eee181553d Mon Sep 17 00:00:00 2001 From: Michael Hamburg Date: Sun, 28 Aug 2016 15:36:55 -0700 Subject: [PATCH] ED25519_NO_CONTEXT -> DECAF_ED25519_NO_CONTEXT; DECAF_ED25519_NO_CONTEXT -> DECAF_EDDSA_25519_SUPPORTS_CONTEXTLESS_SIGS --- src/GENERATED/c/curve25519/eddsa.c | 6 +++--- src/GENERATED/c/ed448goldilocks/eddsa.c | 6 +++--- src/GENERATED/include/decaf/ed255.h | 4 ++-- src/GENERATED/include/decaf/ed255.hxx | 4 ++-- src/GENERATED/include/decaf/ed448.h | 2 +- src/GENERATED/include/decaf/ed448.hxx | 4 ++-- src/per_curve/eddsa.tmpl.c | 6 +++--- src/per_curve/eddsa.tmpl.h | 4 ++-- src/per_curve/eddsa.tmpl.hxx | 4 ++-- test/vectors.inc.cxx | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/GENERATED/c/curve25519/eddsa.c b/src/GENERATED/c/curve25519/eddsa.c index c3d81c5..4e37b82 100644 --- a/src/GENERATED/c/curve25519/eddsa.c +++ b/src/GENERATED/c/curve25519/eddsa.c @@ -28,13 +28,13 @@ #define hash_destroy decaf_sha512_destroy #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 COFACTOR 8 #if NO_CONTEXT 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 /* EDDSA_BASE_POINT_RATIO = 1 or 2 @@ -68,7 +68,7 @@ static void hash_init_with_dom( hash_init(hash); #if NO_CONTEXT - if (context_len == 0 && context == ED25519_NO_CONTEXT) { + if (context_len == 0 && context == DECAF_ED25519_NO_CONTEXT) { (void)prehashed; (void)for_prehash; (void)context; diff --git a/src/GENERATED/c/ed448goldilocks/eddsa.c b/src/GENERATED/c/ed448goldilocks/eddsa.c index bb662b8..9d78fb3 100644 --- a/src/GENERATED/c/ed448goldilocks/eddsa.c +++ b/src/GENERATED/c/ed448goldilocks/eddsa.c @@ -28,13 +28,13 @@ #define hash_destroy decaf_shake256_destroy #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 COFACTOR 4 #if NO_CONTEXT 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 /* EDDSA_BASE_POINT_RATIO = 1 or 2 @@ -68,7 +68,7 @@ static void hash_init_with_dom( hash_init(hash); #if NO_CONTEXT - if (context_len == 0 && context == ED448_NO_CONTEXT) { + if (context_len == 0 && context == DECAF_ED448_NO_CONTEXT) { (void)prehashed; (void)for_prehash; (void)context; diff --git a/src/GENERATED/include/decaf/ed255.h b/src/GENERATED/include/decaf/ed255.h index f9aab4b..4b8c981 100644 --- a/src/GENERATED/include/decaf/ed255.h +++ b/src/GENERATED/include/decaf/ed255.h @@ -33,8 +33,8 @@ extern "C" { #define DECAF_EDDSA_25519_SIGNATURE_BYTES (DECAF_EDDSA_25519_PUBLIC_BYTES + DECAF_EDDSA_25519_PRIVATE_BYTES) /** 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. */ #define decaf_ed25519_prehash_ctx_s decaf_sha512_ctx_s diff --git a/src/GENERATED/include/decaf/ed255.hxx b/src/GENERATED/include/decaf/ed255.hxx index fa53859..84215e9 100644 --- a/src/GENERATED/include/decaf/ed255.hxx +++ b/src/GENERATED/include/decaf/ed255.hxx @@ -56,8 +56,8 @@ typedef class PublicKeyBase PublicKey, PublicKeyPure, PublicKeyPh; /** @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 static inline const Block NO_CONTEXT() { return Block(NULL,0); } #endif diff --git a/src/GENERATED/include/decaf/ed448.h b/src/GENERATED/include/decaf/ed448.h index 1c011ed..a0b5d98 100644 --- a/src/GENERATED/include/decaf/ed448.h +++ b/src/GENERATED/include/decaf/ed448.h @@ -33,7 +33,7 @@ extern "C" { #define DECAF_EDDSA_448_SIGNATURE_BYTES (DECAF_EDDSA_448_PUBLIC_BYTES + DECAF_EDDSA_448_PRIVATE_BYTES) /** 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. */ #define decaf_ed448_prehash_ctx_s decaf_shake256_ctx_s diff --git a/src/GENERATED/include/decaf/ed448.hxx b/src/GENERATED/include/decaf/ed448.hxx index a06d9d9..10c3d4b 100644 --- a/src/GENERATED/include/decaf/ed448.hxx +++ b/src/GENERATED/include/decaf/ed448.hxx @@ -56,8 +56,8 @@ typedef class PublicKeyBase PublicKey, PublicKeyPure, PublicKeyPh; /** @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 static inline const Block NO_CONTEXT() { return Block(NULL,0); } #endif diff --git a/src/per_curve/eddsa.tmpl.c b/src/per_curve/eddsa.tmpl.c index eade6ae..7c48408 100644 --- a/src/per_curve/eddsa.tmpl.c +++ b/src/per_curve/eddsa.tmpl.c @@ -19,13 +19,13 @@ #define hash_destroy decaf_$(eddsa_hash)_destroy #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 COFACTOR $(cofactor) #if NO_CONTEXT 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 /* EDDSA_BASE_POINT_RATIO = 1 or 2 @@ -59,7 +59,7 @@ static void hash_init_with_dom( hash_init(hash); #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)for_prehash; (void)context; diff --git a/src/per_curve/eddsa.tmpl.h b/src/per_curve/eddsa.tmpl.h index de362ab..0c5e7f3 100644 --- a/src/per_curve/eddsa.tmpl.h +++ b/src/per_curve/eddsa.tmpl.h @@ -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) /** 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. */ #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 diff --git a/src/per_curve/eddsa.tmpl.hxx b/src/per_curve/eddsa.tmpl.hxx index 2fa9e66..c88a24a 100644 --- a/src/per_curve/eddsa.tmpl.hxx +++ b/src/per_curve/eddsa.tmpl.hxx @@ -40,8 +40,8 @@ typedef class PublicKeyBase PublicKey, PublicKeyPure, PublicKeyPh; /** @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 static inline const Block NO_CONTEXT() { return Block(NULL,0); } #endif diff --git a/test/vectors.inc.cxx b/test/vectors.inc.cxx index 4731598..766e694 100644 --- a/test/vectors.inc.cxx +++ b/test/vectors.inc.cxx @@ -507,9 +507,9 @@ template<> const Block Tests::eddsa_pk[] = { Block(ed25519_eddsa_pk[4],32) }; template<> const Block Tests::eddsa_context[] = { - Block(ED25519_NO_CONTEXT,0), - Block(ED25519_NO_CONTEXT,0), - Block(ED25519_NO_CONTEXT,0), + EdDSA::NO_CONTEXT(), + EdDSA::NO_CONTEXT(), + EdDSA::NO_CONTEXT(), Block(NULL,0), Block(ed25519_eddsa_context[0],3), Block(ed25519_eddsa_context[1],3)