xref: /freebsd/crypto/libecc/include/libecc/curves/ec_edwards.h (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
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_EDWARDS_H__
17 #define __EC_EDWARDS_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 d;
28 	nn order;
29 	word_t magic;
30 } ec_edwards_crv;
31 
32 typedef ec_edwards_crv *ec_edwards_crv_t;
33 typedef const ec_edwards_crv *ec_edwards_crv_src_t;
34 
35 ATTRIBUTE_WARN_UNUSED_RET int ec_edwards_crv_check_initialized(ec_edwards_crv_src_t crv);
36 ATTRIBUTE_WARN_UNUSED_RET int ec_edwards_crv_init(ec_edwards_crv_t crv, fp_src_t a, fp_src_t b, nn_src_t order);
37 void ec_edwards_crv_uninit(ec_edwards_crv_t crv);
38 
39 #endif /* __EC_EDWARDS_H__ */
40