summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2016-11-11 01:18:19 +0000
committerschwarze <>2016-11-11 01:18:19 +0000
commit9333fef059fd8a14ce70f942c63ed724ac39b325 (patch)
tree4ae5573050bcd66d898ee67b96250b310ebb4f2b
parentaf363730973a40f21fcd7f4e483f6f93f882e29a (diff)
downloadopenbsd-9333fef059fd8a14ce70f942c63ed724ac39b325.tar.gz
openbsd-9333fef059fd8a14ce70f942c63ed724ac39b325.tar.bz2
openbsd-9333fef059fd8a14ce70f942c63ed724ac39b325.zip
import ASN1_TYPE_get(3) from OpenSSL,
deleting ASN1_TYPE_unpack_sequence() and ASN1_TYPE_pack_sequence() which we don't have
-rw-r--r--src/lib/libcrypto/man/ASN1_TYPE_get.3210
-rw-r--r--src/lib/libcrypto/man/Makefile4
2 files changed, 213 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3
new file mode 100644
index 0000000000..cb7f715036
--- /dev/null
+++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3
@@ -0,0 +1,210 @@
1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.1 2016/11/11 01:18:19 schwarze Exp $
2.\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: November 11 2016 $
52.Dt ASN1_TYPE_GET 3
53.Os
54.Sh NAME
55.Nm ASN1_TYPE_get ,
56.Nm ASN1_TYPE_set ,
57.Nm ASN1_TYPE_set1 ,
58.Nm ASN1_TYPE_cmp
59.Nd ASN1_TYPE utility functions
60.Sh SYNOPSIS
61.In openssl/asn1.h
62.Ft int
63.Fo ASN1_TYPE_get
64.Fa "ASN1_TYPE *a"
65.Fc
66.Ft void
67.Fo ASN1_TYPE_set
68.Fa "ASN1_TYPE *a"
69.Fa "int type"
70.Fa "void *value"
71.Fc
72.Ft int
73.Fo ASN1_TYPE_set1
74.Fa "ASN1_TYPE *a"
75.Fa "int type"
76.Fa "const void *value"
77.Fc
78.Ft int
79.Fo ASN1_TYPE_cmp
80.Fa "ASN1_TYPE *a"
81.Fa "ASN1_TYPE *b"
82.Fc
83.Sh DESCRIPTION
84These functions manipulate
85.Vt ASN1_TYPE
86structures.
87An
88.Vt ASN1_TYPE
89structure can contain any ASN.1 type or constructed type such as a
90SEQUENCE: it is effectively equivalent to the ASN.1 ANY type.
91.Pp
92.Fn ASN1_TYPE_get
93returns the type of
94.Fa a .
95.Pp
96.Fn ASN1_TYPE_set
97sets the value of
98.Fa a
99to
100.Fa type
101and
102.Fa value .
103This function uses the pointer
104.Fa value
105internally so it must
106.Sy not
107be freed up after the call.
108.Pp
109.Fn ASN1_TYPE_set1
110sets the value of
111.Fa a
112to
113.Fa type
114and a copy of
115.Fa value .
116.Pp
117.Fn ASN1_TYPE_cmp
118compares ASN.1 types
119.Fa a
120and
121.Fa b .
122.Pp
123The type and meaning of the
124.Fa value
125parameter for
126.Fn ASN1_TYPE_set
127and
128.Fn ASN1_TYPE_set1
129is determined by the
130.Fa type
131parameter.
132If
133.Fa type
134is
135.Dv V_ASN1_NULL ,
136.Fa value
137is ignored.
138If
139.Fa type
140is
141.Dv V_ASN1_BOOLEAN ,
142then the boolean is set to TRUE if
143.Fa value
144is not
145.Dv NULL .
146If
147.Fa type
148is
149.Dv V_ASN1_OBJECT ,
150then
151.Fa value
152is an
153.Vt ASN1_OBJECT
154structure.
155Otherwise
156.Fa type
157is an
158.Vt ASN1_STRING
159structure.
160If
161.Fa type
162corresponds to a primitive type or a string type, then the contents
163of the
164.Vt ASN1_STRING
165contains the content octets of the type.
166If
167.Fa type
168corresponds to a constructed type or a tagged type
169.Pq Dv V_ASN1_SEQUENCE , V_ASN1_SET , No or Dv V_ASN1_OTHER ,
170then the
171.Vt ASN1_STRING
172contains the entire ASN.1 encoding verbatim, including tag and
173length octets.
174.Pp
175.Fn ASN1_TYPE_cmp
176may not return zero if two types are equivalent but have different
177encodings.
178For example the single content octet of the boolean TRUE value under BER
179can have any non-zero encoding but
180.Fn ASN1_TYPE_cmp
181will only return zero if the values are the same.
182.Pp
183If either or both of the parameters passed to
184.Fn ASN1_TYPE_cmp
185is
186.Dv NULL ,
187the return value is non-zero.
188Technically, if both parameters are
189.Dv NULL ,
190the two types could be absent OPTIONAL fields and so should match,
191however passing
192.Dv NULL
193Values could also indicate a programming error (for example an
194unparseable type which returns
195.Dv NULL )
196for types which do
197.Sy not
198match.
199So applications should handle the case of two absent values separately.
200.Sh RETURN VALUES
201.Fn ASN1_TYPE_get
202returns the type of the
203.Vt ASN1_TYPE
204argument.
205.Pp
206.Fn ASN1_TYPE_set1
207returns 1 for success or 0 for failure.
208.Pp
209.Fn ASN1_TYPE_cmp
210returns 0 if the types are identical or non-zero otherwise.
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 718bf91e61..07d736609b 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.50 2016/11/05 20:36:11 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.51 2016/11/11 01:18:19 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -7,6 +7,8 @@ MAN= \
7 ASN1_STRING_length.3 \ 7 ASN1_STRING_length.3 \
8 ASN1_STRING_new.3 \ 8 ASN1_STRING_new.3 \
9 ASN1_STRING_print_ex.3 \ 9 ASN1_STRING_print_ex.3 \
10 ASN1_TIME_set.3 \
11 ASN1_TYPE_get.3 \
10 ASN1_generate_nconf.3 \ 12 ASN1_generate_nconf.3 \
11 ASN1_time_parse.3 \ 13 ASN1_time_parse.3 \
12 BF_set_key.3 \ 14 BF_set_key.3 \