1EC_GROUP_NEW(3)                     OpenSSL                    EC_GROUP_NEW(3)
2
3
4

NAME

6       EC_GROUP_get_ecparameters, EC_GROUP_get_ecpkparameters, EC_GROUP_new,
7       EC_GROUP_new_from_ecparameters, EC_GROUP_new_from_ecpkparameters,
8       EC_GROUP_free, EC_GROUP_clear_free, EC_GROUP_new_curve_GFp,
9       EC_GROUP_new_curve_GF2m, EC_GROUP_new_by_curve_name,
10       EC_GROUP_set_curve, EC_GROUP_get_curve, EC_GROUP_set_curve_GFp,
11       EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m,
12       EC_GROUP_get_curve_GF2m, EC_get_builtin_curves - Functions for creating
13       and destroying EC_GROUP objects
14

SYNOPSIS

16        #include <openssl/ec.h>
17
18        EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
19        EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params)
20        EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params)
21        void EC_GROUP_free(EC_GROUP *group);
22        void EC_GROUP_clear_free(EC_GROUP *group);
23
24        EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
25                                         const BIGNUM *b, BN_CTX *ctx);
26        EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
27                                          const BIGNUM *b, BN_CTX *ctx);
28        EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
29
30        int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
31                               const BIGNUM *b, BN_CTX *ctx);
32        int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
33                               BN_CTX *ctx);
34        int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p,
35                                   const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
36        int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p,
37                                   BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
38        int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p,
39                                    const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
40        int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p,
41                                    BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
42
43        ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, ECPARAMETERS *params)
44        ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, ECPKPARAMETERS *params)
45
46        size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
47

DESCRIPTION

49       Within the library there are two forms of elliptic curve that are of
50       interest.  The first form is those defined over the prime field Fp. The
51       elements of Fp are the integers 0 to p-1, where p is a prime number.
52       This gives us a revised elliptic curve equation as follows:
53
54       y^2 mod p = x^3 +ax + b mod p
55
56       The second form is those defined over a binary field F2^m where the
57       elements of the field are integers of length at most m bits. For this
58       form the elliptic curve equation is modified to:
59
60       y^2 + xy = x^3 + ax^2 + b (where b != 0)
61
62       Operations in a binary field are performed relative to an irreducible
63       polynomial. All such curves with OpenSSL use a trinomial or a
64       pentanomial for this parameter.
65
66       A new curve can be constructed by calling EC_GROUP_new(), using the
67       implementation provided by meth (see EC_GFp_simple_method(3)). It is
68       then necessary to call EC_GROUP_set_curve() to set the curve
69       parameters.  EC_GROUP_new_from_ecparameters() will create a group from
70       the specified params and EC_GROUP_new_from_ecpkparameters() will create
71       a group from the specific PK params.
72
73       EC_GROUP_set_curve() sets the curve parameters p, a and b. For a curve
74       over Fp p is the prime for the field. For a curve over F2^m p
75       represents the irreducible polynomial - each bit represents a term in
76       the polynomial.  Therefore, there will either be three or five bits set
77       dependent on whether the polynomial is a trinomial or a pentanomial.
78       In either case, a and b represents the coefficients a and b from the
79       relevant equation introduced above.
80
81       EC_group_get_curve() obtains the previously set curve parameters.
82
83       EC_GROUP_set_curve_GFp() and EC_GROUP_set_curve_GF2m() are synonyms for
84       EC_GROUP_set_curve(). They are defined for backwards compatibility only
85       and should not be used.
86
87       EC_GROUP_get_curve_GFp() and EC_GROUP_get_curve_GF2m() are synonyms for
88       EC_GROUP_get_curve(). They are defined for backwards compatibility only
89       and should not be used.
90
91       The functions EC_GROUP_new_curve_GFp() and EC_GROUP_new_curve_GF2m()
92       are shortcuts for calling EC_GROUP_new() and then the
93       EC_GROUP_set_curve() function.  An appropriate default implementation
94       method will be used.
95
96       Whilst the library can be used to create any curve using the functions
97       described above, there are also a number of predefined curves that are
98       available. In order to obtain a list of all of the predefined curves,
99       call the function EC_get_builtin_curves(). The parameter r should be an
100       array of EC_builtin_curve structures of size nitems. The function will
101       populate the r array with information about the builtin curves. If
102       nitems is less than the total number of curves available, then the
103       first nitems curves will be returned. Otherwise the total number of
104       curves will be provided. The return value is the total number of curves
105       available (whether that number has been populated in r or not). Passing
106       a NULL r, or setting nitems to 0 will do nothing other than return the
107       total number of curves available.  The EC_builtin_curve structure is
108       defined as follows:
109
110        typedef struct {
111               int nid;
112               const char *comment;
113               } EC_builtin_curve;
114
115       Each EC_builtin_curve item has a unique integer id (nid), and a human
116       readable comment string describing the curve.
117
118       In order to construct a builtin curve use the function
119       EC_GROUP_new_by_curve_name() and provide the nid of the curve to be
120       constructed.
121
122       EC_GROUP_free() frees the memory associated with the EC_GROUP.  If
123       group is NULL nothing is done.
124
125       EC_GROUP_clear_free() destroys any sensitive data held within the
126       EC_GROUP and then frees its memory. If group is NULL nothing is done.
127

RETURN VALUES

129       All EC_GROUP_new* functions return a pointer to the newly constructed
130       group, or NULL on error.
131
132       EC_get_builtin_curves() returns the number of builtin curves that are
133       available.
134
135       EC_GROUP_set_curve_GFp(), EC_GROUP_get_curve_GFp(),
136       EC_GROUP_set_curve_GF2m(), EC_GROUP_get_curve_GF2m() return 1 on
137       success or 0 on error.
138

SEE ALSO

140       crypto(7), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3),
141       EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)
142
144       Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.
145
146       Licensed under the OpenSSL license (the "License").  You may not use
147       this file except in compliance with the License.  You can obtain a copy
148       in the file LICENSE in the source distribution or at
149       <https://www.openssl.org/source/license.html>.
150
151
152
1531.1.1l                            2021-09-15                   EC_GROUP_NEW(3)
Impressum