diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/ASN1_item_d2i.3 | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/src/lib/libcrypto/man/ASN1_item_d2i.3 b/src/lib/libcrypto/man/ASN1_item_d2i.3 index afdd234c23..4bdaf4bad4 100644 --- a/src/lib/libcrypto/man/ASN1_item_d2i.3 +++ b/src/lib/libcrypto/man/ASN1_item_d2i.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ASN1_item_d2i.3,v 1.3 2016/12/27 08:20:27 jmc Exp $ | 1 | .\" $OpenBSD: ASN1_item_d2i.3,v 1.4 2017/01/03 23:56:50 schwarze Exp $ |
2 | .\" OpenSSL doc/man3/d2i_X509.pod b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL doc/man3/d2i_X509.pod b97fdb57 Nov 11 09:33:09 2016 +0100 |
3 | .\" | 3 | .\" |
4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
@@ -65,16 +65,18 @@ | |||
65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
67 | .\" | 67 | .\" |
68 | .Dd $Mdocdate: December 27 2016 $ | 68 | .Dd $Mdocdate: January 3 2017 $ |
69 | .Dt ASN1_ITEM_D2I 3 | 69 | .Dt ASN1_ITEM_D2I 3 |
70 | .Os | 70 | .Os |
71 | .Sh NAME | 71 | .Sh NAME |
72 | .Nm ASN1_item_d2i , | 72 | .Nm ASN1_item_d2i , |
73 | .Nm ASN1_item_d2i_bio , | 73 | .Nm ASN1_item_d2i_bio , |
74 | .Nm ASN1_item_d2i_fp , | 74 | .Nm ASN1_item_d2i_fp , |
75 | .Nm d2i_ASN1_TYPE , | ||
75 | .Nm ASN1_item_i2d , | 76 | .Nm ASN1_item_i2d , |
76 | .Nm ASN1_item_i2d_bio , | 77 | .Nm ASN1_item_i2d_bio , |
77 | .Nm ASN1_item_i2d_fp , | 78 | .Nm ASN1_item_i2d_fp , |
79 | .Nm i2d_ASN1_TYPE , | ||
78 | .Nm ASN1_item_dup , | 80 | .Nm ASN1_item_dup , |
79 | .Nm ASN1_item_print | 81 | .Nm ASN1_item_print |
80 | .Nd decode and encode ASN.1 objects | 82 | .Nd decode and encode ASN.1 objects |
@@ -99,6 +101,12 @@ | |||
99 | .Fa "FILE *in_fp" | 101 | .Fa "FILE *in_fp" |
100 | .Fa "void *val_out" | 102 | .Fa "void *val_out" |
101 | .Fc | 103 | .Fc |
104 | .Ft ASN1_TYPE * | ||
105 | .Fo d2i_ASN1_TYPE | ||
106 | .Fa "ASN1_TYPE **val_out" | ||
107 | .Fa "const unsigned char **der_in" | ||
108 | .Fa "long length" | ||
109 | .Fc | ||
102 | .Ft int | 110 | .Ft int |
103 | .Fo ASN1_item_i2d | 111 | .Fo ASN1_item_i2d |
104 | .Fa "ASN1_VALUE *val_in" | 112 | .Fa "ASN1_VALUE *val_in" |
@@ -117,6 +125,11 @@ | |||
117 | .Fa "FILE *out_fp" | 125 | .Fa "FILE *out_fp" |
118 | .Fa "void *val_in" | 126 | .Fa "void *val_in" |
119 | .Fc | 127 | .Fc |
128 | .Ft int | ||
129 | .Fo i2d_ASN1_TYPE | ||
130 | .Fa "ASN1_TYPE *val_in" | ||
131 | .Fa "unsigned char **der_out" | ||
132 | .Fc | ||
120 | .Ft void * | 133 | .Ft void * |
121 | .Fo ASN1_item_dup | 134 | .Fo ASN1_item_dup |
122 | .Fa "const ASN1_ITEM *it" | 135 | .Fa "const ASN1_ITEM *it" |
@@ -131,19 +144,21 @@ | |||
131 | .Fa "const ASN1_PCTX *pctx" | 144 | .Fa "const ASN1_PCTX *pctx" |
132 | .Fc | 145 | .Fc |
133 | .Sh DESCRIPTION | 146 | .Sh DESCRIPTION |
134 | These functions convert ASN.1 values from their DER encoding to | 147 | These functions convert ASN.1 values from their BER encoding to |
135 | internal C structures | 148 | internal C structures |
136 | .Pq Dq d2i | 149 | .Pq Dq d2i |
137 | and vice versa | 150 | and vice versa |
138 | .Pq Dq i2d . | 151 | .Pq Dq i2d . |
139 | Unlike the C structures which contain pointers to sub-objects, DER | 152 | Unlike the C structures which contain pointers to sub-objects, BER |
140 | is a serialized encoding, suitable for transfer over the network | 153 | is a serialized encoding, suitable for transfer over the network |
141 | and for storage in a file. | 154 | and for storage in a file. |
142 | .Pp | 155 | .Pp |
143 | .Fn ASN1_item_d2i | 156 | .Fn ASN1_item_d2i |
144 | interpretes | 157 | interpretes |
145 | .Pf * Fa der_in | 158 | .Pf * Fa der_in |
146 | as a DER- or BER-encoded byte array and decodes | 159 | as a DER- or BER-encoded byte array and decodes one value of type |
160 | .Fa it | ||
161 | represented by up to | ||
147 | .Fa length | 162 | .Fa length |
148 | bytes. | 163 | bytes. |
149 | If successful, | 164 | If successful, |
@@ -187,6 +202,14 @@ or | |||
187 | .Vt FILE , | 202 | .Vt FILE , |
188 | respectively. | 203 | respectively. |
189 | .Pp | 204 | .Pp |
205 | .Fn d2i_ASN1_TYPE | ||
206 | is similar to | ||
207 | .Fn ASN1_item_d2i | ||
208 | except that it does not require a desired type to be specified by | ||
209 | the user, but instead returns an | ||
210 | .Vt ASN1_TYPE | ||
211 | wrapper object containing both the type and the value found in the input. | ||
212 | .Pp | ||
190 | .Fn ASN1_item_i2d | 213 | .Fn ASN1_item_i2d |
191 | encodes the object pointed to by | 214 | encodes the object pointed to by |
192 | .Fa val_in | 215 | .Fa val_in |
@@ -239,6 +262,14 @@ or | |||
239 | .Vt FILE , | 262 | .Vt FILE , |
240 | respectively. | 263 | respectively. |
241 | .Pp | 264 | .Pp |
265 | .Fn i2d_ASN1_TYPE | ||
266 | is similar to | ||
267 | .Fn ASN1_item_i2d | ||
268 | except that the type and the value are not provided separately, | ||
269 | but in the form of a single | ||
270 | .Vt ASN1_TYPE | ||
271 | object. | ||
272 | .Pp | ||
242 | .Fn ASN1_item_dup | 273 | .Fn ASN1_item_dup |
243 | creates a deep copy of | 274 | creates a deep copy of |
244 | .Fa val_in | 275 | .Fa val_in |
@@ -250,8 +281,9 @@ and | |||
250 | If successful, | 281 | If successful, |
251 | .Fn ASN1_item_d2i , | 282 | .Fn ASN1_item_d2i , |
252 | .Fn ASN1_item_d2i_bio , | 283 | .Fn ASN1_item_d2i_bio , |
284 | .Fn ASN1_item_d2i_fp , | ||
253 | and | 285 | and |
254 | .Fn ASN1_item_d2i_fp | 286 | .Fn d2i_ASN1_TYPE |
255 | return a pointer to the decoded ASN.1 value. | 287 | return a pointer to the decoded ASN.1 value. |
256 | In addition, if | 288 | In addition, if |
257 | .Fa val_out | 289 | .Fa val_out |
@@ -264,7 +296,9 @@ If an error occurs, | |||
264 | is returned. | 296 | is returned. |
265 | .Pp | 297 | .Pp |
266 | .Fn ASN1_item_i2d | 298 | .Fn ASN1_item_i2d |
267 | returns the number of bytes written | 299 | and |
300 | .Fn i2d_ASN1_TYPE | ||
301 | return the number of bytes written | ||
268 | or a negative value if an error occurs. | 302 | or a negative value if an error occurs. |
269 | .Pp | 303 | .Pp |
270 | .Fn ASN1_item_i2d_bio | 304 | .Fn ASN1_item_i2d_bio |
@@ -282,7 +316,9 @@ if an error occurs. | |||
282 | Many type-specific wrapper functions exist. | 316 | Many type-specific wrapper functions exist. |
283 | Using those wrappers is recommended in application code | 317 | Using those wrappers is recommended in application code |
284 | because it restores part of the type safety that the low-level | 318 | because it restores part of the type safety that the low-level |
285 | interfaces described in the present manual page lack. | 319 | interfaces using |
320 | .Vt ASN1_VALUE | ||
321 | lack. | ||
286 | .Pp | 322 | .Pp |
287 | For example, to allocate a buffer and write the DER encoding of an | 323 | For example, to allocate a buffer and write the DER encoding of an |
288 | .Vt X509 | 324 | .Vt X509 |
@@ -325,7 +361,8 @@ if (d2i_X509(&x, &p, len) == NULL) | |||
325 | /* error */ | 361 | /* error */ |
326 | .Ed | 362 | .Ed |
327 | .Sh SEE ALSO | 363 | .Sh SEE ALSO |
328 | .Xr ASN1_item_new 3 | 364 | .Xr ASN1_item_new 3 , |
365 | .Xr ASN1_TYPE_new 3 | ||
329 | .Sh CAVEATS | 366 | .Sh CAVEATS |
330 | If the type described by | 367 | If the type described by |
331 | .Fa it | 368 | .Fa it |