summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2016-12-25 17:05:59 +0000
committerschwarze <>2016-12-25 17:05:59 +0000
commitb2f86408e8e75c40843e1aa1b516e0ce1d9e4142 (patch)
tree160f9ca38a3af5452bc07bd90d3af04b62b072cf /src/lib
parent9a8331c777966b9f0bb29f2ba224f1d443f509ae (diff)
downloadopenbsd-b2f86408e8e75c40843e1aa1b516e0ce1d9e4142.tar.gz
openbsd-b2f86408e8e75c40843e1aa1b516e0ce1d9e4142.tar.bz2
openbsd-b2f86408e8e75c40843e1aa1b516e0ce1d9e4142.zip
Basic cleanup to prepare for content improvements:
Use the same parameter names as in ASN1_item_d2i(3). Point to ASN1_item_d2i(3) for details. Delete lots of rendundant text. While here, add ten missing functions found in OpenSSL doc/man3/d2i_X509.pod and fix errors in the prototypes of i2d_ECPKParameters_bio(3) and i2d_ECPKParameters_fp(3).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/d2i_ECPKParameters.3343
1 files changed, 172 insertions, 171 deletions
diff --git a/src/lib/libcrypto/man/d2i_ECPKParameters.3 b/src/lib/libcrypto/man/d2i_ECPKParameters.3
index edecdee67c..3ad7c16cab 100644
--- a/src/lib/libcrypto/man/d2i_ECPKParameters.3
+++ b/src/lib/libcrypto/man/d2i_ECPKParameters.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_ECPKParameters.3,v 1.7 2016/12/11 14:22:43 schwarze Exp $ 1.\" $OpenBSD: d2i_ECPKParameters.3,v 1.8 2016/12/25 17:05:59 schwarze Exp $
2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 2.\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3.\" 3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>. 4.\" This file was written by Matt Caswell <matt@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 11 2016 $ 51.Dd $Mdocdate: December 25 2016 $
52.Dt D2I_ECPKPARAMETERS 3 52.Dt D2I_ECPKPARAMETERS 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -63,190 +63,186 @@
63.Nm ECParameters_dup , 63.Nm ECParameters_dup ,
64.Nm d2i_ECPrivateKey , 64.Nm d2i_ECPrivateKey ,
65.Nm i2d_ECPrivateKey , 65.Nm i2d_ECPrivateKey ,
66.Nm d2i_ECPrivateKey_bio ,
67.Nm i2d_ECPrivateKey_bio ,
68.Nm d2i_ECPrivateKey_fp ,
69.Nm i2d_ECPrivateKey_fp ,
66.Nm o2i_ECPublicKey , 70.Nm o2i_ECPublicKey ,
67.Nm i2o_ECPublicKey , 71.Nm i2o_ECPublicKey ,
68.Nm ECPKParameters_print , 72.Nm ECPKParameters_print ,
69.Nm ECPKParameters_print_fp , 73.Nm ECPKParameters_print_fp ,
70.Nm ECParameters_print , 74.Nm ECParameters_print ,
71.Nm ECParameters_print_fp 75.Nm ECParameters_print_fp ,
76.Nm d2i_EC_PUBKEY ,
77.Nm i2d_EC_PUBKEY ,
78.Nm d2i_EC_PUBKEY_bio ,
79.Nm i2d_EC_PUBKEY_bio ,
80.Nm d2i_EC_PUBKEY_fp ,
81.Nm i2d_EC_PUBKEY_fp
72.Nd decode and encode ASN.1 representations of elliptic curve entities 82.Nd decode and encode ASN.1 representations of elliptic curve entities
73.Sh SYNOPSIS 83.Sh SYNOPSIS
74.In openssl/ec.h 84.In openssl/ec.h
75.Ft EC_GROUP * 85.Ft EC_GROUP *
76.Fo d2i_ECPKParameters 86.Fo d2i_ECPKParameters
77.Fa "EC_GROUP **px" 87.Fa "EC_GROUP **val_out"
78.Fa "const unsigned char **in" 88.Fa "const unsigned char **des_in"
79.Fa "long len" 89.Fa "long length"
80.Fc 90.Fc
81.Ft int 91.Ft int
82.Fo i2d_ECPKParameters 92.Fo i2d_ECPKParameters
83.Fa "const EC_GROUP *x" 93.Fa "const EC_GROUP *val_in"
84.Fa "unsigned char **out" 94.Fa "unsigned char **des_out"
85.Fc 95.Fc
86.Ft EC_GROUP * 96.Ft EC_GROUP *
87.Fo d2i_ECPKParameters_bio 97.Fo d2i_ECPKParameters_bio
88.Fa "BIO *bp" 98.Fa "BIO *in_bio"
89.Fa "EC_GROUP **px" 99.Fa "EC_GROUP **val_out"
90.Fc 100.Fc
91.Ft int 101.Ft int
92.Fo i2d_ECPKParameters_bio 102.Fo i2d_ECPKParameters_bio
93.Fa "BIO *bp" 103.Fa "BIO *out_bio"
94.Fa "EC_GROUP **px" 104.Fa "EC_GROUP *val_in"
95.Fc 105.Fc
96.Ft EC_GROUP * 106.Ft EC_GROUP *
97.Fo d2i_ECPKParameters_fp 107.Fo d2i_ECPKParameters_fp
98.Fa "FILE *fp" 108.Fa "FILE *in_fp"
99.Fa "EC_GROUP **px" 109.Fa "EC_GROUP **val_out"
100.Fc 110.Fc
101.Ft int 111.Ft int
102.Fo i2d_ECPKParameters_fp 112.Fo i2d_ECPKParameters_fp
103.Fa "FILE *fp" 113.Fa "FILE *out_fp"
104.Fa "EC_GROUP **px" 114.Fa "EC_GROUP *val_in"
105.Fc 115.Fc
106.Ft EC_KEY * 116.Ft EC_KEY *
107.Fo d2i_ECParameters 117.Fo d2i_ECParameters
108.Fa "EC_KEY **key" 118.Fa "EC_KEY **val_out"
109.Fa "const unsigned char **in" 119.Fa "const unsigned char **des_in"
110.Fa "long len" 120.Fa "long length"
111.Fc 121.Fc
112.Ft int 122.Ft int
113.Fo i2d_ECParameters 123.Fo i2d_ECParameters
114.Fa "EC_KEY *key" 124.Fa "EC_KEY *val_in"
115.Fa "unsigned char **out" 125.Fa "unsigned char **des_out"
116.Fc 126.Fc
117.Ft EC_KEY * 127.Ft EC_KEY *
118.Fo ECParameters_dup 128.Fo ECParameters_dup
119.Fa "EC_KEY *key" 129.Fa "EC_KEY *val_in"
120.Fc 130.Fc
121.Ft EC_KEY * 131.Ft EC_KEY *
122.Fo d2i_ECPrivateKey 132.Fo d2i_ECPrivateKey
123.Fa "EC_KEY **key" 133.Fa "EC_KEY **val_out"
124.Fa "const unsigned char **in" 134.Fa "const unsigned char **des_in"
125.Fa "long len" 135.Fa "long length"
126.Fc 136.Fc
127.Ft int 137.Ft int
128.Fo i2d_ECPrivateKey 138.Fo i2d_ECPrivateKey
129.Fa "EC_KEY *key" 139.Fa "EC_KEY *val_in"
130.Fa "unsigned char **out" 140.Fa "unsigned char **des_out"
141.Fc
142.Ft EC_KEY *
143.Fo d2i_ECPrivateKey_bio
144.Fa "BIO *in_bio"
145.Fa "EC_KEY **val_out"
146.Fc
147.Ft int
148.Fo i2d_ECPrivateKey_bio
149.Fa "BIO *out_bio"
150.Fa "EC_KEY *val_in"
151.Fc
152.Ft EC_KEY *
153.Fo d2i_ECPrivateKey_fp
154.Fa "FILE *in_fp"
155.Fa "EC_KEY **val_out"
156.Fc
157.Ft int
158.Fo i2d_ECPKPrivateKey_fp
159.Fa "FILE *out_fp"
160.Fa "EC_KEY *val_in"
131.Fc 161.Fc
132.Ft EC_KEY * 162.Ft EC_KEY *
133.Fo o2i_ECPublicKey 163.Fo o2i_ECPublicKey
134.Fa "EC_KEY **key" 164.Fa "EC_KEY **val_out"
135.Fa "const unsigned char **in" 165.Fa "const unsigned char **des_in"
136.Fa "long len" 166.Fa "long length"
137.Fc 167.Fc
138.Ft int 168.Ft int
139.Fo i2o_ECPublicKey 169.Fo i2o_ECPublicKey
140.Fa "EC_KEY *key" 170.Fa "EC_KEY *val_in"
141.Fa "unsigned char **out" 171.Fa "unsigned char **des_out"
142.Fc 172.Fc
143.Ft int 173.Ft int
144.Fo ECPKParameters_print 174.Fo ECPKParameters_print
145.Fa "BIO *bp" 175.Fa "BIO *out_bio"
146.Fa "const EC_GROUP *x" 176.Fa "const EC_GROUP *val_in"
147.Fa "int off" 177.Fa "int indent"
148.Fc 178.Fc
149.Ft int 179.Ft int
150.Fo ECPKParameters_print_fp 180.Fo ECPKParameters_print_fp
151.Fa "FILE *fp" 181.Fa "FILE *out_fp"
152.Fa "const EC_GROUP *x" 182.Fa "const EC_GROUP *val_in"
153.Fa "int off" 183.Fa "int indent"
154.Fc 184.Fc
155.Ft int 185.Ft int
156.Fo ECParameters_print 186.Fo ECParameters_print
157.Fa "BIO *bp" 187.Fa "BIO *out_bio"
158.Fa "const EC_KEY *key" 188.Fa "const EC_KEY *val_in"
159.Fc 189.Fc
160.Ft int 190.Ft int
161.Fo ECParameters_print_fp 191.Fo ECParameters_print_fp
162.Fa "FILE *fp" 192.Fa "FILE *out_fp"
163.Fa "const EC_KEY *key" 193.Fa "const EC_KEY *val_in"
194.Fc
195.In openssl/x509.h
196.Ft EC_KEY *
197.Fo d2i_EC_PUBKEY
198.Fa "EC_KEY **val_out"
199.Fa "const unsigned char **des_in"
200.Fa "long length"
201.Fc
202.Ft int
203.Fo i2d_EC_PUBKEY
204.Fa "EC_KEY *val_in"
205.Fa "unsigned char **des_out"
206.Fc
207.Ft EC_KEY *
208.Fo d2i_EC_PUBKEY_bio
209.Fa "BIO *in_bio"
210.Fa "EC_KEY **val_out"
211.Fc
212.Ft int
213.Fo i2d_EC_PUBKEY_bio
214.Fa "BIO *out_bio"
215.Fa "EC_KEY *val_in"
216.Fc
217.Ft EC_KEY *
218.Fo d2i_EC_PUBKEY_fp
219.Fa "FILE *in_fp"
220.Fa "EC_KEY **val_out"
221.Fc
222.Ft int
223.Fo i2d_ECPK_PUBKEY_fp
224.Fa "FILE *out_fp"
225.Fa "EC_KEY *val_in"
164.Fc 226.Fc
165.Sh DESCRIPTION 227.Sh DESCRIPTION
166.Fn d2i_ECPKParameters 228These functions decode and encode elliptic curve keys and parameters.
167attempts to decode 229For details about the semantics, examples, caveats, and bugs, see
168.Fa len 230.Xr ASN1_item_d2i 3 .
169bytes at
170.Pf * Fa in .
171If successful, a pointer to the
172.Vt EC_GROUP
173structure is returned.
174If an error occurred, then
175.Dv NULL
176is returned.
177If
178.Fa px
179is not
180.Dv NULL ,
181then the returned structure is written to
182.Pf * Fa px .
183If
184.Pf * Fa px
185is not
186.Dv NULL ,
187then it is assumed that
188.Pf * Fa px
189contains a valid
190.Vt EC_GROUP
191structure and an attempt is made to reuse it.
192If the call is successful,
193.Pf * Fa in
194is incremented to the byte following the parsed data.
195.Pp
196.Fn i2d_ECPKParameters
197encodes the structure pointed to by
198.Fa x
199into DER format.
200If
201.Fa out
202is not
203.Dv NULL ,
204is writes the DER encoded data to the buffer at
205.Pf * Fa out
206and increments it to point after the data just written.
207If the return value is negative, an error occurred, otherwise it returns
208the length of the encoded data.
209.Pp
210If
211.Pf * Fa out
212is
213.Dv NULL ,
214memory will be allocated for a buffer and the encoded data written to it.
215In this case
216.Pf * Fa out
217is not incremented, and it points to the start of the data just written.
218.Pp 231.Pp
219.Fn d2i_ECPKParameters_bio
220is similar to
221.Fn d2i_ECPKParameters
222except it attempts to parse data from
223.Vt BIO
224.Fa bp .
225.Fn d2i_ECPKParameters_fp
226is similar to
227.Fn d2i_ECPKParameters 232.Fn d2i_ECPKParameters
228except it attempts to parse data from the 233and
229.Vt FILE
230pointer
231.Fa fp .
232.Fn i2d_ECPKParameters_bio
233is similar to
234.Fn i2d_ECPKParameters 234.Fn i2d_ECPKParameters
235except it writes the encoding of the structure 235decode and encode the parameters of an elliptic curve.
236.Fa x 236.Fn d2i_ECPKParameters_bio ,
237to 237.Fn i2d_ECPKParameters_bio ,
238.Vt BIO 238.Fn d2i_ECPKParameters_fp ,
239.Fa bp 239and
240and it returns 1 for success or 0 for failure.
241.Fn i2d_ECPKParameters_fp 240.Fn i2d_ECPKParameters_fp
242is similar to 241are similar except that they decode or encode using a
243.Fn i2d_ECPKParameters
244except it writes the encoding of the structure
245.Fa x
246to
247.Vt BIO 242.Vt BIO
248.Sy bp 243or
249and it returns 1 for success or 0 for failure. 244.Vt FILE
245pointer.
250These four functions are currently implemented as macros. 246These four functions are currently implemented as macros.
251.Pp 247.Pp
252.Fn d2i_ECParameters 248.Fn d2i_ECParameters
@@ -262,82 +258,77 @@ structure.
262produces the same output as 258produces the same output as
263.Fn i2d_ECPKParameters 259.Fn i2d_ECPKParameters
264but uses 260but uses
265.Fa key->group 261.Fa val_in->group
266for input instead of 262for input instead of
267.Fa px . 263.Fa val_in .
268.Pp 264.Pp
269.Fn ECParameters_dup 265.Fn ECParameters_dup
270copies 266copies
271.Fa key 267.Fa val_in
272by calling 268by calling
273.Fn i2d_ECParameters 269.Fn i2d_ECParameters
274and 270and
275.Fn d2i_ECParameters . 271.Fn d2i_ECParameters .
276.Pp 272.Pp
277.Fn d2i_ECPrivateKey 273.Fn d2i_ECPrivateKey
278interprets 274and
279.Fa len
280bytes at
281.Fa in
282as a DER-encoded private key, decodes it, stores the result in
283.Fa key
284as described above, and returns a pointer to it.
285.Pp
286.Fn i2d_ECPrivateKey 275.Fn i2d_ECPrivateKey
287encodes the private key 276decode and encode an EC private key.
288.Fa a 277.Fn d2i_ECPrivateKey_bio ,
289into DER format and writes it to 278.Fn i2d_ECPrivateKey_bio ,
290.Fa out 279.Fn d2i_ECPrivateKey_fp ,
291as described above. 280and
281.Fn i2d_ECPrivateKey_fp
282are similar except that they decode or encode using a
283.Vt BIO
284or
285.Vt FILE
286pointer.
292.Pp 287.Pp
293.Fn o2i_ECPublicKey 288.Fn o2i_ECPublicKey
294takes a string of 289and
295.Fa len
296octets from
297.Fa in ,
298decodes them, and stores the resulting EC public key in the existing
299.Pf * Fa key .
300.Pp
301.Fn i2o_ECPublicKey 290.Fn i2o_ECPublicKey
302encodes the public 291decode and encode an EC public key.
303.Fa key 292.Fn o2i_ECPublicKey
304into the octet string buffer 293can store a key into an existing object.
305.Pf * Fa out .
306If
307.Pf * Fa out
308is
309.Dv NULL ,
310a new buffer of the required size is allocated;
311otherwise, the pointer is advanced to point to the octet
312after the last one written.
313.Pp
314These functions are very similar to the X.509 functions described in
315.Xr d2i_X509 3 ,
316where further notes and examples are available.
317.Pp 294.Pp
318The
319.Fn ECPKParameters_print 295.Fn ECPKParameters_print
320and 296and
321.Fn ECPKParameters_print_fp 297.Fn ECPKParameters_print_fp
322functions print human-readable output of the public parameters of the 298print human-readable output of the public parameters of the
323.Vt EC_GROUP 299.Vt EC_GROUP
324to 300to
325.Fa bp 301.Fa out_bio
326or 302or
327.Fa fp . 303.Fa out_fp .
328The output lines are indented by 304The output lines are indented by
329.Fa off 305.Fa indent
330spaces. 306spaces.
331.Pp 307.Pp
332.Fn ECParameters_print 308.Fn ECParameters_print
333and 309and
334.Fn ECParameters_print_fp 310.Fn ECParameters_print_fp
335print the parameter components of 311print the parameter components of
336.Fa key 312.Fa val_in
337to 313to
338.Fa bp 314.Fa out_bio
339or 315or
340.Fa fp . 316.Fa out_fp .
317.Pp
318.Fn d2i_EC_PUBKEY
319and
320.Fn i2d_EC_PUBKEY
321decode and encode an EC public key.
322.Fn d2i_EC_PUBKEY_bio ,
323.Fn i2d_EC_PUBKEY_bio ,
324.Fn d2i_EC_PUBKEY_fp ,
325and
326.Fn i2d_EC_PUBKEY_fp
327are similar except that they decode or encode using a
328.Vt BIO
329or
330.Vt FILE
331pointer.
341.Sh RETURN VALUES 332.Sh RETURN VALUES
342.Fn d2i_ECPKParameters , 333.Fn d2i_ECPKParameters ,
343.Fn d2i_ECPKParameters_bio , 334.Fn d2i_ECPKParameters_bio ,
@@ -352,8 +343,13 @@ if an error occurs.
352.Fn d2i_ECParameters , 343.Fn d2i_ECParameters ,
353.Fn ECParameters_dup , 344.Fn ECParameters_dup ,
354.Fn d2i_ECPrivateKey , 345.Fn d2i_ECPrivateKey ,
346.Fn d2i_ECPrivateKey_bio ,
347.Fn d2i_ECPrivateKey_fp ,
348.Fn o2i_ECPublicKey ,
349.Fn d2i_EC_PUBKEY ,
350.Fn d2i_EC_PUBKEY_bio ,
355and 351and
356.Fn o2i_ECPublicKey 352.Fn d2i_EC_PUBKEY_fp
357return a valid 353return a valid
358.Vt EC_KEY 354.Vt EC_KEY
359structure or 355structure or
@@ -363,21 +359,26 @@ if an error occurs.
363.Fn i2d_ECPKParameters , 359.Fn i2d_ECPKParameters ,
364.Fn i2d_ECParameters , 360.Fn i2d_ECParameters ,
365.Fn i2d_ECPrivateKey , 361.Fn i2d_ECPrivateKey ,
362.Fn i2o_ECPublicKey ,
366and 363and
367.Fn i2o_ECPublicKey 364.Fn i2d_EC_PUBKEY
368return the number of bytes successfully encoded or a negative value if 365return the number of bytes successfully encoded or a negative value if
369an error occurs. 366an error occurs.
370.Pp 367.Pp
371.Fn i2d_ECPKParameters_bio , 368.Fn i2d_ECPKParameters_bio ,
372.Fn i2d_ECPKParameters_fp , 369.Fn i2d_ECPKParameters_fp ,
370.Fn i2d_ECPrivateKey_bio ,
371.Fn i2d_ECPKPrivateKey_fp ,
373.Fn ECPKParameters_print , 372.Fn ECPKParameters_print ,
374.Fn ECPKParameters_print_fp , 373.Fn ECPKParameters_print_fp ,
375.Fn ECParameters_print , 374.Fn ECParameters_print ,
375.Fn ECParameters_print_fp ,
376.Fn i2d_EC_PUBKEY_bio ,
376and 377and
377.Fn ECParameters_print_fp 378.Fn i2d_ECPK_PUBKEY_fp
378return 1 for success or 0 if an error occurs. 379return 1 for success or 0 if an error occurs.
379.Sh SEE ALSO 380.Sh SEE ALSO
380.Xr d2i_X509 3 , 381.Xr ASN1_item_d2i 3 ,
381.Xr EC_GFp_simple_method 3 , 382.Xr EC_GFp_simple_method 3 ,
382.Xr EC_GROUP_copy 3 , 383.Xr EC_GROUP_copy 3 ,
383.Xr EC_GROUP_new 3 , 384.Xr EC_GROUP_new 3 ,