1EC_GROUP_new(3)                     OpenSSL                    EC_GROUP_new(3)
2
3
4

NAME

6       EC_GROUP_new, EC_GROUP_free, EC_GROUP_clear_free,
7       EC_GROUP_new_curve_GFp, EC_GROUP_new_curve_GF2m,
8       EC_GROUP_new_by_curve_name, EC_GROUP_set_curve_GFp,
9       EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m,
10       EC_GROUP_get_curve_GF2m, EC_get_builtin_curves - Functions for creating
11       and destroying EC_GROUP objects.
12

SYNOPSIS

14        #include <openssl/ec.h>
15        #include <openssl/bn.h>
16
17        EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
18        void EC_GROUP_free(EC_GROUP *group);
19        void EC_GROUP_clear_free(EC_GROUP *group);
20
21        EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
22        EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
23        EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
24
25        int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
26        int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
27        int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
28        int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
29
30        size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
31

DESCRIPTION

33       Within the library there are two forms of elliptic curve that are of
34       interest. The first form is those defined over the prime field Fp. The
35       elements of Fp are the integers 0 to p-1, where p is a prime number.
36       This gives us a revised elliptic curve equation as follows:
37
38       y^2 mod p = x^3 +ax + b mod p
39
40       The second form is those defined over a binary field F2^m where the
41       elements of the field are integers of length at most m bits. For this
42       form the elliptic curve equation is modified to:
43
44       y^2 + xy = x^3 + ax^2 + b (where b != 0)
45
46       Operations in a binary field are performed relative to an irreducible
47       polynomial. All such curves with OpenSSL use a trinomial or a
48       pentanomial for this parameter.
49
50       A new curve can be constructed by calling EC_GROUP_new, using the
51       implementation provided by meth (see EC_GFp_simple_method(3)). It is
52       then necessary to call either EC_GROUP_set_curve_GFp or
53       EC_GROUP_set_curve_GF2m as appropriate to create a curve defined over
54       Fp or over F2^m respectively.
55
56       EC_GROUP_set_curve_GFp sets the curve parameters p, a and b for a curve
57       over Fp stored in group.  EC_group_get_curve_GFp obtains the previously
58       set curve parameters.
59
60       EC_GROUP_set_curve_GF2m sets the equivalent curve parameters for a
61       curve over F2^m. In this case p represents the irreducible polybnomial
62       - each bit represents a term in the polynomial. Therefore there will
63       either be three or five bits set dependant on whether the polynomial is
64       a trinomial or a pentanomial.  EC_group_get_curve_GF2m obtains the
65       previously set curve parameters.
66
67       The functions EC_GROUP_new_curve_GFp and EC_GROUP_new_curve_GF2m are
68       shortcuts for calling EC_GROUP_new and the appropriate
69       EC_group_set_curve function. An appropriate default implementation
70       method will be used.
71
72       Whilst the library can be used to create any curve using the functions
73       described above, there are also a number of predefined curves that are
74       available. In order to obtain a list of all of the predefined curves,
75       call the function EC_get_builtin_curves. The parameter r should be an
76       array of EC_builtin_curve structures of size nitems. The function will
77       populate the r array with information about the builtin curves. If
78       nitems is less than the total number of curves available, then the
79       first nitems curves will be returned. Otherwise the total number of
80       curves will be provided. The return value is the total number of curves
81       available (whether that number has been populated in r or not). Passing
82       a NULL r, or setting nitems to 0 will do nothing other than return the
83       total number of curves available.  The EC_builtin_curve structure is
84       defined as follows:
85
86        typedef struct {
87               int nid;
88               const char *comment;
89               } EC_builtin_curve;
90
91       Each EC_builtin_curve item has a unique integer id (nid), and a human
92       readable comment string describing the curve.
93
94       In order to construct a builtin curve use the function
95       EC_GROUP_new_by_curve_name and provide the nid of the curve to be
96       constructed.
97
98       EC_GROUP_free frees the memory associated with the EC_GROUP.
99
100       EC_GROUP_clear_free destroys any sensitive data held within the
101       EC_GROUP and then frees its memory.
102

RETURN VALUES

104       All EC_GROUP_new* functions return a pointer to the newly constructed
105       group, or NULL on error.
106
107       EC_get_builtin_curves returns the number of builtin curves that are
108       available.
109
110       EC_GROUP_set_curve_GFp, EC_GROUP_get_curve_GFp,
111       EC_GROUP_set_curve_GF2m, EC_GROUP_get_curve_GF2m return 1 on success or
112       0 on error.
113

SEE ALSO

115       crypto(3), ec(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3),
116       EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)
117
118
119
1201.0.2o                            2020-08-01                   EC_GROUP_new(3)
Impressum