Unverified Commit c49f2b01 authored by Ola Bini's avatar Ola Bini
Browse files

Remove a bunch of duplicated stuff

parent e1472080
......@@ -13,9 +13,7 @@
#include <goldilocks/ed448.h>
#include <goldilocks/shake.h>
#include <string.h>
#define API_NAME "goldilocks_448"
#define API_NS(_id) goldilocks_448_##_id
#include "api.h"
#define hash_ctx_t goldilocks_shake256_ctx_t
#define hash_init goldilocks_shake256_init
......@@ -25,7 +23,6 @@
#define hash_hash goldilocks_shake256_hash
#define NO_CONTEXT GOLDILOCKS_EDDSA_448_SUPPORTS_CONTEXTLESS_SIGS
#define COFACTOR 4
#define EDDSA_PREHASH_BYTES 64
#if NO_CONTEXT
......
......@@ -11,11 +11,10 @@
#include "word.h"
#include "field.h"
#include <goldilocks.h>
#include "api.h"
/* Template stuff */
#define API_NS(_id) goldilocks_448_##_id
#define point_t API_NS(point_t)
#define COFACTOR 4
static const int EDWARDS_D = -39081;
/* End of template stuff */
......
......@@ -14,16 +14,11 @@
#include <goldilocks.h>
#include <goldilocks/ed448.h>
#include "api.h"
/* Template stuff */
#define API_NS(_id) goldilocks_448_##_id
#define SCALAR_BITS GOLDILOCKS_448_SCALAR_BITS
#define SCALAR_SER_BYTES GOLDILOCKS_448_SCALAR_BYTES
#define SCALAR_LIMBS GOLDILOCKS_448_SCALAR_LIMBS
#define scalar_t API_NS(scalar_t)
#define point_t API_NS(point_t)
#define precomputed_s API_NS(precomputed_s)
#define COFACTOR 4
/* Comb config: number of combs, n, t, s. */
#define COMBS_N 5
......@@ -53,8 +48,6 @@ const gf GOLDILOCKS_448_FACTOR = {FIELD_LITERAL(
/* End of template stuff */
#define WBITS GOLDILOCKS_WORD_BITS /* NB this may be different from ARCH_WORD_BITS */
extern const point_t API_NS(point_base);
/* Projective Niels coordinates */
......
......@@ -15,8 +15,8 @@
#include "field.h"
#include "f_field.h"
#include "goldilocks.h"
#include "api.h"
#define API_NS(_id) goldilocks_448_##_id
static const unsigned char base_point_ser_for_pregen[SER_BYTES] = {
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33
};
......
/**
* @file api.h
* @brief Generic api helper header.
* @copyright
* Copyright (c) 2018 Centro de Autonomía Digital \n
* Released under the MIT License. See LICENSE.txt for license information.
* @author Ola Bini
*/
#ifndef __API_H__
#define __API_H__
#define API_NAME "goldilocks_448"
#define API_NS(_id) goldilocks_448_##_id
#define COFACTOR 4
#define SCALAR_BITS GOLDILOCKS_448_SCALAR_BITS
#define SCALAR_SER_BYTES GOLDILOCKS_448_SCALAR_BYTES
#define SCALAR_LIMBS GOLDILOCKS_448_SCALAR_LIMBS
#define scalar_t API_NS(scalar_t)
#define WBITS GOLDILOCKS_WORD_BITS /* NB this may be different from ARCH_WORD_BITS */
#endif // __API_H__
......@@ -11,13 +11,7 @@
#include "word.h"
#include "constant_time.h"
#include <goldilocks.h>
/* Template stuff */
#define API_NS(_id) goldilocks_448_##_id
#define SCALAR_BITS GOLDILOCKS_448_SCALAR_BITS
#define SCALAR_SER_BYTES GOLDILOCKS_448_SCALAR_BYTES
#define SCALAR_LIMBS GOLDILOCKS_448_SCALAR_LIMBS
#define scalar_t API_NS(scalar_t)
#include "api.h"
static const goldilocks_word_t MONTGOMERY_FACTOR = (goldilocks_word_t)0x3bd440fae918bc5ull;
static const scalar_t sc_p = {{{
......@@ -27,8 +21,6 @@ static const scalar_t sc_p = {{{
}}};
/* End of template stuff */
#define WBITS GOLDILOCKS_WORD_BITS /* NB this may be different from ARCH_WORD_BITS */
const scalar_t API_NS(scalar_one) = {{{1}}}, API_NS(scalar_zero) = {{{0}}};
/** {extra,accum} - sub +? p
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment