xref: /openbsd-src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3 (revision a5f4f7b9d55c288140e963903758271044f356cf)
1.\" $OpenBSD: d2i_ASN1_SEQUENCE_ANY.3,v 1.3 2021/12/09 19:05:09 schwarze Exp $
2.\"
3.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: December 9 2021 $
18.Dt D2I_ASN1_SEQUENCE_ANY 3
19.Os
20.Sh NAME
21.Nm d2i_ASN1_SEQUENCE_ANY ,
22.Nm i2d_ASN1_SEQUENCE_ANY ,
23.Nm d2i_ASN1_SET_ANY ,
24.Nm i2d_ASN1_SET_ANY
25.Nd decode and encode ASN.1 sequences and sets
26.Sh SYNOPSIS
27.In openssl/asn1.h
28.Ft ASN1_SEQUENCE_ANY *
29.Fo d2i_ASN1_SEQUENCE_ANY
30.Fa "ASN1_SEQUENCE_ANY **val_out"
31.Fa "const unsigned char **der_in"
32.Fa "long length"
33.Fc
34.Ft int
35.Fo i2d_ASN1_SEQUENCE_ANY
36.Fa "const ASN1_SEQUENCE_ANY *val_in"
37.Fa "unsigned char **der_out"
38.Fc
39.Ft ASN1_SEQUENCE_ANY *
40.Fo d2i_ASN1_SET_ANY
41.Fa "ASN1_SEQUENCE_ANY **val_out"
42.Fa "const unsigned char **der_in"
43.Fa "long length"
44.Fc
45.Ft int
46.Fo i2d_ASN1_SET_ANY
47.Fa "const ASN1_SEQUENCE_ANY *val_in"
48.Fa "unsigned char **der_out"
49.Fc
50.Sh DESCRIPTION
51These functions decode and encode ASN.1 sequences and sets,
52which are also represented by the
53.Dv V_ASN1_SEQUENCE
54and
55.Dv V_ASN1_SET
56type identifier constants, respectively.
57For details about the semantics, examples, caveats, and bugs, see
58.Xr ASN1_item_d2i 3 .
59.Pp
60The type
61.Vt ASN1_SEQUENCE_ANY
62is defined as
63.Vt STACK_OF(ASN1_TYPE) .
64Whether such an object represents a sequence or a set is not stored
65in the object itself but needs to be remembered separately.
66.Pp
67Like for
68.Xr d2i_ASN1_TYPE 3
69and
70.Xr i2d_ASN1_TYPE 3 ,
71the type of the individual values contained in the sequence or set
72is not specified when calling the functions.
73It might vary among the members, and it is stored together with
74each value in each
75.Vt ASN1_TYPE
76object contained in the sequence or set.
77.Sh RETURN VALUES
78.Fn d2i_ASN1_SEQUENCE_ANY
79returns an
80.Vt ASN1_SEQUENCE_ANY
81object or
82.Dv NULL
83if an error occurs.
84.Pp
85.Fn i2d_ASN1_SEQUENCE_ANY
86returns the number of bytes written or a negative value if an error
87occurs.
88.Sh SEE ALSO
89.Xr ASN1_item_d2i 3 ,
90.Xr ASN1_TYPE_new 3
91.Sh HISTORY
92.Fn d2i_ASN1_SEQUENCE_ANY ,
93.Fn i2d_ASN1_SEQUENCE_ANY ,
94.Fn d2i_ASN1_SET_ANY ,
95and
96.Fn i2d_ASN1_SET_ANY
97first appeared in OpenSSL 1.0.0 and have been available since
98.Ox 4.9 .
99