diff options
author | schwarze <> | 2016-11-02 11:57:56 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-02 11:57:56 +0000 |
commit | 90c573eba184fe31184d14ce10367f810fa1d417 (patch) | |
tree | 62d26e7f75bb451eba292aad57737306b2f28280 /src/lib/libcrypto/man/EC_GROUP_new.3 | |
parent | db06cab2812484b360f2873ade2dd8277ad08a42 (diff) | |
download | openbsd-90c573eba184fe31184d14ce10367f810fa1d417.tar.gz openbsd-90c573eba184fe31184d14ce10367f810fa1d417.tar.bz2 openbsd-90c573eba184fe31184d14ce10367f810fa1d417.zip |
convert DSA and EC manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/EC_GROUP_new.3')
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_new.3 | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EC_GROUP_new.3 b/src/lib/libcrypto/man/EC_GROUP_new.3 new file mode 100644 index 0000000000..00690dfc07 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_new.3 | |||
@@ -0,0 +1,240 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_GROUP_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_GROUP_new , | ||
6 | .Nm EC_GROUP_free , | ||
7 | .Nm EC_GROUP_clear_free , | ||
8 | .Nm EC_GROUP_new_curve_GFp , | ||
9 | .Nm EC_GROUP_new_curve_GF2m , | ||
10 | .Nm EC_GROUP_new_by_curve_name , | ||
11 | .Nm EC_GROUP_set_curve_GFp , | ||
12 | .Nm EC_GROUP_get_curve_GFp , | ||
13 | .Nm EC_GROUP_set_curve_GF2m , | ||
14 | .Nm EC_GROUP_get_curve_GF2m , | ||
15 | .Nm EC_get_builtin_curves | ||
16 | .Nd create and destroy EC_GROUP objects | ||
17 | .Sh SYNOPSIS | ||
18 | .In openssl/ec.h | ||
19 | .In openssl/bn.h | ||
20 | .Ft EC_GROUP * | ||
21 | .Fo EC_GROUP_new | ||
22 | .Fa "const EC_METHOD *meth" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fo EC_GROUP_free | ||
26 | .Fa "EC_GROUP *group" | ||
27 | .Fc | ||
28 | .Ft void | ||
29 | .Fo EC_GROUP_clear_free | ||
30 | .Fa "EC_GROUP *group" | ||
31 | .Fc | ||
32 | .Ft EC_GROUP * | ||
33 | .Fo EC_GROUP_new_curve_GFp | ||
34 | .Fa "const BIGNUM *p" | ||
35 | .Fa "const BIGNUM *a" | ||
36 | .Fa "const BIGNUM *b" | ||
37 | .Fa "BN_CTX *ctx" | ||
38 | .Fc | ||
39 | .Ft EC_GROUP * | ||
40 | .Fo EC_GROUP_new_curve_GF2m | ||
41 | .Fa "const BIGNUM *p" | ||
42 | .Fa "const BIGNUM *a" | ||
43 | .Fa "const BIGNUM *b" | ||
44 | .Fa "BN_CTX *ctx" | ||
45 | .Fc | ||
46 | .Ft EC_GROUP * | ||
47 | .Fo EC_GROUP_new_by_curve_name | ||
48 | .Fa "int nid" | ||
49 | .Fc | ||
50 | .Ft int | ||
51 | .Fo EC_GROUP_set_curve_GFp | ||
52 | .Fa "EC_GROUP *group" | ||
53 | .Fa "const BIGNUM *p" | ||
54 | .Fa "const BIGNUM *a" | ||
55 | .Fa "const BIGNUM *b" | ||
56 | .Fa "BN_CTX *ctx" | ||
57 | .Fc | ||
58 | .Ft int | ||
59 | .Fo EC_GROUP_get_curve_GFp | ||
60 | .Fa "const EC_GROUP *group" | ||
61 | .Fa "BIGNUM *p" | ||
62 | .Fa "BIGNUM *a" | ||
63 | .Fa "BIGNUM *b" | ||
64 | .Fa "BN_CTX *ctx" | ||
65 | .Fc | ||
66 | .Ft int | ||
67 | .Fo EC_GROUP_set_curve_GF2m | ||
68 | .Fa "EC_GROUP *group" | ||
69 | .Fa "const BIGNUM *p" | ||
70 | .Fa "const BIGNUM *a" | ||
71 | .Fa "const BIGNUM *b" | ||
72 | .Fa "BN_CTX *ctx" | ||
73 | .Fc | ||
74 | .Ft int | ||
75 | .Fo EC_GROUP_get_curve_GF2m | ||
76 | .Fa "const EC_GROUP *group" | ||
77 | .Fa "BIGNUM *p" | ||
78 | .Fa "BIGNUM *a" | ||
79 | .Fa "BIGNUM *b" | ||
80 | .Fa "BN_CTX *ctx" | ||
81 | .Fc | ||
82 | .Ft size_t | ||
83 | .Fo EC_get_builtin_curves | ||
84 | .Fa "EC_builtin_curve *r" | ||
85 | .Fa "size_t nitems" | ||
86 | .Fc | ||
87 | .Sh DESCRIPTION | ||
88 | Within the library there are two forms of elliptic curves that are of | ||
89 | interest. | ||
90 | The first form is those defined over the prime field Fp. | ||
91 | The elements of Fp are the integers 0 to p-1, where | ||
92 | .Fa p | ||
93 | is a prime number. | ||
94 | This gives us a revised elliptic curve equation as follows: | ||
95 | .Pp | ||
96 | .Dl y^2 mod p = x^3 +ax + b mod p | ||
97 | .Pp | ||
98 | The second form is those defined over a binary field F2^m where the | ||
99 | elements of the field are integers of length at most m bits. | ||
100 | For this form the elliptic curve equation is modified to: | ||
101 | .Pp | ||
102 | .Dl y^2 + xy = x^3 + ax^2 + b (where b != 0) | ||
103 | .Pp | ||
104 | Operations in a binary field are performed relative to an irreducible | ||
105 | polynomial. | ||
106 | All such curves with OpenSSL use a trinomial or a pentanomial for this | ||
107 | parameter. | ||
108 | .Pp | ||
109 | A new curve can be constructed by calling | ||
110 | .Fn EC_GROUP_new , | ||
111 | using the implementation provided by | ||
112 | .Fa meth | ||
113 | (see | ||
114 | .Xr EC_GFp_simple_method 3 ) . | ||
115 | It is then necessary to call either | ||
116 | .Fn EC_GROUP_set_curve_GFp | ||
117 | or | ||
118 | .Fn EC_GROUP_set_curve_GF2m | ||
119 | as appropriate to create a curve defined over Fp or over F2^m, respectively. | ||
120 | .Pp | ||
121 | .Fn EC_GROUP_set_curve_GFp | ||
122 | sets the curve parameters | ||
123 | .Fa p , | ||
124 | .Fa a , | ||
125 | and | ||
126 | .Fa b | ||
127 | for a curve over Fp stored in | ||
128 | .Fa group . | ||
129 | .Fn EC_group_get_curve_GFp | ||
130 | obtains the previously set curve parameters. | ||
131 | .Pp | ||
132 | .Fn EC_GROUP_set_curve_GF2m | ||
133 | sets the equivalent curve parameters for a curve over F2^m. | ||
134 | In this case | ||
135 | .Fa p | ||
136 | represents the irreducible polynomial - each bit represents a term in | ||
137 | the polynomial. | ||
138 | Therefore there will either be three or five bits set dependent on | ||
139 | whether the polynomial is a trinomial or a pentanomial. | ||
140 | .Fn EC_group_get_curve_GF2m | ||
141 | obtains the previously set curve parameters. | ||
142 | .Pp | ||
143 | The functions | ||
144 | .Fn EC_GROUP_new_curve_GFp | ||
145 | and | ||
146 | .Fn EC_GROUP_new_curve_GF2m | ||
147 | are shortcuts for calling | ||
148 | .Fn EC_GROUP_new | ||
149 | and the appropriate | ||
150 | .Fn EC_GROUP_set_curve_* | ||
151 | function. | ||
152 | An appropriate default implementation method will be used. | ||
153 | .Pp | ||
154 | Whilst the library can be used to create any curve using the functions | ||
155 | described above, there are also a number of predefined curves that are | ||
156 | available. | ||
157 | In order to obtain a list of all of the predefined curves, call the | ||
158 | function | ||
159 | .Fn EC_get_builtin_curves . | ||
160 | The parameter | ||
161 | .Fa r | ||
162 | should be an array of | ||
163 | .Vt EC_builtin_cure | ||
164 | structures of size | ||
165 | .Fa nitems . | ||
166 | The function will populate the | ||
167 | .Fa r | ||
168 | array with information about the builtin curves. | ||
169 | If | ||
170 | .Fa nitems | ||
171 | is less than the total number of curves available, then the first | ||
172 | .Fa nitems | ||
173 | curves will be returned. | ||
174 | Otherwise the total number of curves will be provided. | ||
175 | The return value is the total number of curves available (whether that | ||
176 | number has been populated in | ||
177 | .Fa r | ||
178 | or not). | ||
179 | Passing a | ||
180 | .Dv NULL | ||
181 | .Fa r , | ||
182 | or setting | ||
183 | .Fa nitems | ||
184 | to 0, will do nothing other than return the total number of curves | ||
185 | available. | ||
186 | The | ||
187 | .Vt EC_builtin_curve | ||
188 | structure is defined as follows: | ||
189 | .Bd -literal | ||
190 | typedef struct { | ||
191 | int nid; | ||
192 | const char *comment; | ||
193 | } EC_builtin_curve; | ||
194 | .Ed | ||
195 | .Pp | ||
196 | Each | ||
197 | .Vt EC_builtin_curve | ||
198 | item has a unique integer id | ||
199 | .Pq Fa nid | ||
200 | and a human readable comment string describing the curve. | ||
201 | .Pp | ||
202 | In order to construct a builtin curve use the function | ||
203 | .Fn EC_GROUP_new_by_curve_name | ||
204 | and provide the | ||
205 | .Fa nid | ||
206 | of the curve to be constructed. | ||
207 | .Pp | ||
208 | .Fn EC_GROUP_free | ||
209 | frees the memory associated with the | ||
210 | .Vt EC_GROUP . | ||
211 | .Pp | ||
212 | .Fn EC_GROUP_clear_free | ||
213 | destroys any sensitive data held within the | ||
214 | .Vt EC_GROUP | ||
215 | and then frees its memory. | ||
216 | .Sh RETURN VALUES | ||
217 | All | ||
218 | .Fn EC_GROUP_new* | ||
219 | functions return a pointer to the newly constructed group or | ||
220 | .Dv NULL | ||
221 | on error. | ||
222 | .Pp | ||
223 | .Fn EC_get_builtin_curves | ||
224 | returns the number of builtin curves that are available. | ||
225 | .Pp | ||
226 | .Fn EC_GROUP_set_curve_GFp , | ||
227 | .Fn EC_GROUP_get_curve_GFp , | ||
228 | .Fn EC_GROUP_set_curve_GF2m , | ||
229 | and | ||
230 | .Fn EC_GROUP_get_curve_GF2m | ||
231 | return 1 on success or 0 on error. | ||
232 | .Sh SEE ALSO | ||
233 | .Xr crypto 3 , | ||
234 | .Xr d2i_ECPKParameters 3 , | ||
235 | .Xr ec 3 , | ||
236 | .Xr EC_GFp_simple_method 3 , | ||
237 | .Xr EC_GROUP_copy 3 , | ||
238 | .Xr EC_KEY_new 3 , | ||
239 | .Xr EC_POINT_add 3 , | ||
240 | .Xr EC_POINT_new 3 | ||