summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/ASN1_item_new.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/man/ASN1_item_new.3103
1 files changed, 103 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/ASN1_item_new.3 b/src/lib/libcrypto/man/ASN1_item_new.3
new file mode 100644
index 0000000000..0444bbe15a
--- /dev/null
+++ b/src/lib/libcrypto/man/ASN1_item_new.3
@@ -0,0 +1,103 @@
1.\" $OpenBSD: ASN1_item_new.3,v 1.1 2016/12/24 21:42:29 schwarze Exp $
2.\"
3.\" Copyright (c) 2016 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 24 2016 $
18.Dt ASN1_ITEM_NEW 3
19.Os
20.Sh NAME
21.Nm ASN1_item_new ,
22.Nm ASN1_item_free
23.Nd generic ASN.1 value constructor and destructor
24.Sh SYNOPSIS
25.In openssl/asn1.h
26.Ft ASN1_VALUE *
27.Fo ASN1_item_new
28.Fa "const ASN1_ITEM *it"
29.Fc
30.Ft void
31.Fo ASN1_item_free
32.Fa "ASN1_VALUE *val_in"
33.Fa "const ASN1_ITEM *it"
34.Fc
35.Sh DESCRIPTION
36.Fn ASN1_item_new
37allocates and initializes an empty ASN.1 value
38of the type described by the global static object
39.Fa it .
40.Pp
41.Fn ASN1_item_free
42frees an ASN.1 value of the type described by
43.Fa it .
44If the true type of
45.Fa val_in
46fails to match the specified
47.Fa it ,
48buffer overflows and segmentation faults are likely to occur.
49It is not possible to recover the type of an
50.Vt ASN1_VALUE
51object by inspecting it; the type always needs to be remembered
52separately.
53.Pp
54.Vt ASN1_VALUE
55is an incomplete type, and pointers to it always require casting
56to the correct complete type before they can be dereferenced.
57For all practical purposes, a pointer to
58.Vt ASN1_VALUE
59is equivalent to a
60.Vt void
61pointer.
62.Pp
63Depending on
64.Fa it ,
65there are more than 150 different types that
66.Fn ASN1_item_new
67may return.
68Most of them are pointers to structures or pointers to arrays of
69structures, but there are a few exceptions, for example:
70If
71.Fa it
72is
73.Dv ASN1_NULL_it ,
74.Fn ASN1_item_new
75returns a specific invalid pointer representing the unique
76.Vt ASN1_NULL
77object.
78If
79.Fa it
80is
81.Dv ASN1_BOOLEAN_it
82or
83.Dv LONG_it ,
84.Fn ASN1_item_new
85does not return a pointer at all, but a
86.Vt long
87value cast to
88.Vt ASN1_VALUE * .
89.Sh RETURN VALUES
90.Fn ASN1_item_new
91returns the new
92.Vt ASN1_VALUE
93object or
94.Dv NULL
95if an error occurs.
96.Sh SEE ALSO
97.Xr ASN1_item_d2i 3 ,
98.Xr OBJ_nid2obj 3
99.Sh BUGS
100The
101.Vt ASN1_VALUE
102type compromises type safety and invites programming mistakes that
103will typically have severe consequences.