blob: 2d6d92a7cb92dfc736955f940c57865525d7985e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*
* ecgen, tool for generating Elliptic curve domain parameters
* Copyright (C) 2017 J08nY
*/
/**
* @file field.h
*/
#ifndef ECGEN_FIELD_H
#define ECGEN_FIELD_H
#include "io/cli.h"
#include "types.h"
/**
* GENERATOR(gen_t)
* Creates a random field.
* Always succeeds.
*
* @param curve
* @param config
* @param args unused
* @return state diff
*/
int field_random(curve_t *curve, config_t *config, arg_t *args);
/**
* GENERATOR(gen_t)
* Creates a field by reading:
* - a prime number in the prime field case
* - three short exponents of the reduction polynomial in the binary case
*
* @param curve
* @param config
* @param args unused
* @return state diff
*/
int field_input(curve_t *curve, config_t *config, arg_t *args);
/**
* Extract a field representation from a field.
* - char(field) == 2:
* returns the vector of powers of middle coefficients of the reduction
* polynomial.
* - char(field) != 2:
* returns the vector of the field characteristic(p).
*
* @param field
* @return field representation
*/
GEN field_params(GEN field);
/**
* Transforms a field element to an integer.
* Uses the polynomial basis of the underlying field in case of a binary field.
*
* @param element t_INTMOD, t_INT, t_FFELT to transform
* @return t_INT
*/
GEN field_elementi(GEN element);
#endif // ECGEN_FIELD_H
|