1 /* 2 * Copyright (C) 2017 - This file is part of libecc project 3 * 4 * Authors: 5 * Ryad BENADJILA <ryadbenadjila@gmail.com> 6 * Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr> 7 * Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr> 8 * 9 * Contributors: 10 * Nicolas VIVET <nicolas.vivet@ssi.gouv.fr> 11 * Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr> 12 * 13 * This software is licensed under a dual BSD and GPL v2 license. 14 * See LICENSE file at the root folder of the project. 15 */ 16 #ifndef __EC_SHORTW_H__ 17 #define __EC_SHORTW_H__ 18 19 #include <libecc/nn/nn.h> 20 #include <libecc/fp/fp.h> 21 #include <libecc/fp/fp_add.h> 22 #include <libecc/fp/fp_mul.h> 23 #include <libecc/fp/fp_mul_redc1.h> 24 25 typedef struct { 26 fp a; 27 fp b; 28 fp a_monty; 29 #ifndef NO_USE_COMPLETE_FORMULAS 30 fp b3; 31 fp b_monty; 32 fp b3_monty; 33 #endif 34 nn order; /* curve order */ 35 word_t magic; 36 } ec_shortw_crv; 37 38 typedef ec_shortw_crv *ec_shortw_crv_t; 39 typedef const ec_shortw_crv *ec_shortw_crv_src_t; 40 41 ATTRIBUTE_WARN_UNUSED_RET int ec_shortw_crv_check_initialized(ec_shortw_crv_src_t crv); 42 ATTRIBUTE_WARN_UNUSED_RET int ec_shortw_crv_init(ec_shortw_crv_t crv, fp_src_t a, fp_src_t b, nn_src_t order); 43 void ec_shortw_crv_uninit(ec_shortw_crv_t crv); 44 45 #endif /* __EC_SHORTW_H__ */ 46