From 74dbbf0b0a8a9b01909f484296162d44c1df2edc Mon Sep 17 00:00:00 2001 From: Michael Hamburg Date: Tue, 27 Jan 2015 13:33:33 -0800 Subject: [PATCH] a few more doc points --- include/decaf.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/decaf.h b/include/decaf.h index 6f035dd..23353bf 100644 --- a/include/decaf.h +++ b/include/decaf.h @@ -23,21 +23,35 @@ #include typedef uint64_t decaf_word_t, decaf_bool_t; + +/* TODO: perfield, so when 25519 hits this will change */ +#define DECAF_FIELD_BITS 448 #define DECAF_LIMBS (512/8/sizeof(decaf_word_t)) -#define DECAF_SER_BYTES 56 + +/** Number of bytes in a serialized point. One less bit than you'd think. */ +#define DECAF_SER_BYTES ((DECAF_FIELD_BITS+6)/8) + +/** Twisted Edwards (-1,d-1) extended homogeneous coordinates */ typedef struct decaf_point_s { decaf_word_t x[DECAF_LIMBS],y[DECAF_LIMBS],z[DECAF_LIMBS],t[DECAF_LIMBS]; } decaf_point_t[1]; static const decaf_bool_t DECAF_TRUE = -(decaf_bool_t)1, DECAF_FALSE = 0; + +/** NB Success is -1, failure is 0. TODO: see if people would rather the reverse. */ static const decaf_bool_t DECAF_SUCCESS = DECAF_TRUE, DECAF_FAILURE = DECAF_FALSE; +/** The identity point on the curve. */ const decaf_point_t decaf_identity; +/** An arbitrarily chosen base point on the curve. TODO: define */ +const decaf_point_t decaf_basepoint; + #ifdef __cplusplus extern "C" { #endif - + +/* Goldilocks' build flags default to hidden and stripping executables. */ #define API_VIS __attribute__((visibility("default"))) #define WARN_UNUSED __attribute__((warn_unused_result)) #define NONNULL2 __attribute__((nonnull(1,2)))