From 0c60af55fe855061d94377e5e33c8d3367715a96 Mon Sep 17 00:00:00 2001 From: Michael Hamburg Date: Fri, 13 Oct 2017 17:26:26 -0700 Subject: [PATCH] clear a couple todos. still have to rename the clear cofactor fns --- src/generator/curve_data.py | 4 ++-- src/per_curve/eddsa.tmpl.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/generator/curve_data.py b/src/generator/curve_data.py index 2e4148c..dd88ac2 100644 --- a/src/generator/curve_data.py +++ b/src/generator/curve_data.py @@ -137,8 +137,8 @@ for curve,data in curve_data.items(): # This is a HACK. The real problem is that iso-Ed25519 # has points at infinity unless you IMAGINE_TWIST. # - # Also there are lots of bugs when cofactor=8 && !IMAGINE_TWIST. - # (FIXME, eventually) + # Also there are lots of bugs when cofactor=8 != IMAGINE_TWIST. + # (FUTURE: fix all this to support other curves, eventually) if data["modulus"]%4 == 3: data["imagine_twist"] = 0 else: data["imagine_twist"] = 1 # data["imagine_twist"] = 0 diff --git a/src/per_curve/eddsa.tmpl.c b/src/per_curve/eddsa.tmpl.c index fb0210e..a05f468 100644 --- a/src/per_curve/eddsa.tmpl.c +++ b/src/per_curve/eddsa.tmpl.c @@ -22,6 +22,7 @@ #define NO_CONTEXT DECAF_EDDSA_$(gf_shortname)_SUPPORTS_CONTEXTLESS_SIGS #define EDDSA_USE_SIGMA_ISOGENY $(eddsa_sigma_iso) #define COFACTOR $(cofactor) +#define EDDSA_PREHASH_BYTES 64 #if NO_CONTEXT const uint8_t NO_CONTEXT_POINTS_HERE = 0; @@ -228,7 +229,7 @@ void decaf_ed$(gf_shortname)_sign_prehash ( const uint8_t *context, uint8_t context_len ) { - uint8_t hash_output[64]; /* MAGIC but true for all existing schemes */ + uint8_t hash_output[EDDSA_PREHASH_BYTES]; { decaf_ed$(gf_shortname)_prehash_ctx_t hash_too; memcpy(hash_too,hash,sizeof(hash_too)); @@ -303,7 +304,7 @@ decaf_error_t decaf_ed$(gf_shortname)_verify_prehash ( ) { decaf_error_t ret; - uint8_t hash_output[64]; /* MAGIC but true for all existing schemes */ + uint8_t hash_output[EDDSA_PREHASH_BYTES]; { decaf_ed$(gf_shortname)_prehash_ctx_t hash_too; memcpy(hash_too,hash,sizeof(hash_too));