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 b 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
79       EC_group_get_curve() obtains the previously set curve parameters.
80
81       EC_GROUP_set_curve_GFp() and EC_GROUP_set_curve_GF2m() are synonyms for
82       EC_GROUP_set_curve(). They are defined for backwards compatibility only
83       and should not be used.
84
85       EC_GROUP_get_curve_GFp() and EC_GROUP_get_curve_GF2m() are synonyms for
86       EC_GROUP_get_curve(). They are defined for backwards compatibility only
87       and should not be used.
88
89       The functions EC_GROUP_new_curve_GFp and EC_GROUP_new_curve_GF2m are
90       shortcuts for calling EC_GROUP_new and then the EC_GROUP_set_curve
91       function. An appropriate default implementation method will be used.
92
93       Whilst the library can be used to create any curve using the functions
94       described above, there are also a number of predefined curves that are
95       available. In order to obtain a list of all of the predefined curves,
96       call the function EC_get_builtin_curves. The parameter r should be an
97       array of EC_builtin_curve structures of size nitems. The function will
98       populate the r array with information about the builtin curves. If
99       nitems is less than the total number of curves available, then the
100       first nitems curves will be returned. Otherwise the total number of
101       curves will be provided. The return value is the total number of curves
102       available (whether that number has been populated in r or not). Passing
103       a NULL r, or setting nitems to 0 will do nothing other than return the
104       total number of curves available.  The EC_builtin_curve structure is
105       defined as follows:
106
107        typedef struct {
108               int nid;
109               const char *comment;
110               } EC_builtin_curve;
111
112       Each EC_builtin_curve item has a unique integer id (nid), and a human
113       readable comment string describing the curve.
114
115       In order to construct a builtin curve use the function
116       EC_GROUP_new_by_curve_name and provide the nid of the curve to be
117       constructed.
118
119       EC_GROUP_free frees the memory associated with the EC_GROUP.  If group
120       is NULL nothing is done.
121
122       EC_GROUP_clear_free destroys any sensitive data held within the
123       EC_GROUP and then frees its memory.  If group is NULL nothing is done.
124

RETURN VALUES

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

SEE ALSO

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