diff options
author | schwarze <> | 2018-07-08 23:00:17 +0000 |
---|---|---|
committer | schwarze <> | 2018-07-08 23:00:17 +0000 |
commit | 3c26295b1f9b718f2e9d39df5dd95d25d2b75449 (patch) | |
tree | 336eb58caf05a3e0a34eab842af3ba10c14cd7c5 /src | |
parent | a51380503298b0c41145c83097cef24b51c30aea (diff) | |
download | openbsd-3c26295b1f9b718f2e9d39df5dd95d25d2b75449.tar.gz openbsd-3c26295b1f9b718f2e9d39df5dd95d25d2b75449.tar.bz2 openbsd-3c26295b1f9b718f2e9d39df5dd95d25d2b75449.zip |
import the relevant parts of a new ASN1_INTEGER_get(3) manual page
from OpenSSL, fixing many bugs and polishing many details
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/ASN1_INTEGER_get.3 | 238 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
2 files changed, 240 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 new file mode 100644 index 0000000000..e3585b4088 --- /dev/null +++ b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 | |||
@@ -0,0 +1,238 @@ | |||
1 | .\" $OpenBSD: ASN1_INTEGER_get.3,v 1.1 2018/07/08 23:00:17 schwarze Exp $ | ||
2 | .\" selective merge up to: | ||
3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 eaf39a9f Jun 23 10:24:00 2018 +0200 | ||
4 | .\" | ||
5 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
6 | .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" | ||
12 | .\" 1. Redistributions of source code must retain the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer. | ||
14 | .\" | ||
15 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer in | ||
17 | .\" the documentation and/or other materials provided with the | ||
18 | .\" distribution. | ||
19 | .\" | ||
20 | .\" 3. All advertising materials mentioning features or use of this | ||
21 | .\" software must display the following acknowledgment: | ||
22 | .\" "This product includes software developed by the OpenSSL Project | ||
23 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
24 | .\" | ||
25 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | .\" endorse or promote products derived from this software without | ||
27 | .\" prior written permission. For written permission, please contact | ||
28 | .\" openssl-core@openssl.org. | ||
29 | .\" | ||
30 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
31 | .\" nor may "OpenSSL" appear in their names without prior written | ||
32 | .\" permission of the OpenSSL Project. | ||
33 | .\" | ||
34 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
35 | .\" acknowledgment: | ||
36 | .\" "This product includes software developed by the OpenSSL Project | ||
37 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
38 | .\" | ||
39 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | .\" | ||
52 | .Dd $Mdocdate: July 8 2018 $ | ||
53 | .Dt ASN1_INTEGER_GET 3 | ||
54 | .Os | ||
55 | .Sh NAME | ||
56 | .Nm ASN1_INTEGER_get , | ||
57 | .Nm ASN1_INTEGER_set , | ||
58 | .Nm BN_to_ASN1_INTEGER , | ||
59 | .Nm ASN1_INTEGER_to_BN , | ||
60 | .Nm ASN1_ENUMERATED_get , | ||
61 | .Nm ASN1_ENUMERATED_set , | ||
62 | .Nm BN_to_ASN1_ENUMERATED , | ||
63 | .Nm ASN1_ENUMERATED_to_BN | ||
64 | .Nd ASN.1 INTEGER and ENUMERATED utilities | ||
65 | .Sh SYNOPSIS | ||
66 | .In openssl/asn1.h | ||
67 | .Ft long | ||
68 | .Fo ASN1_INTEGER_get | ||
69 | .Fa "const ASN1_INTEGER *a" | ||
70 | .Fc | ||
71 | .Ft int | ||
72 | .Fo ASN1_INTEGER_set | ||
73 | .Fa "ASN1_INTEGER *a" | ||
74 | .Fa "long v" | ||
75 | .Fc | ||
76 | .Ft ASN1_INTEGER * | ||
77 | .Fo BN_to_ASN1_INTEGER | ||
78 | .Fa "const BIGNUM *bn" | ||
79 | .Fa "ASN1_INTEGER *ai" | ||
80 | .Fc | ||
81 | .Ft BIGNUM * | ||
82 | .Fo ASN1_INTEGER_to_BN | ||
83 | .Fa "const ASN1_INTEGER *ai" | ||
84 | .Fa "BIGNUM *bn" | ||
85 | .Fc | ||
86 | .Ft long | ||
87 | .Fo ASN1_ENUMERATED_get | ||
88 | .Fa "const ASN1_ENUMERATED *a" | ||
89 | .Fc | ||
90 | .Ft int | ||
91 | .Fo ASN1_ENUMERATED_set | ||
92 | .Fa "ASN1_ENUMERATED *a" | ||
93 | .Fa "long v" | ||
94 | .Fc | ||
95 | .Ft ASN1_ENUMERATED * | ||
96 | .Fo BN_to_ASN1_ENUMERATED | ||
97 | .Fa "const BIGNUM *bn" | ||
98 | .Fa "ASN1_ENUMERATED *ai" | ||
99 | .Fc | ||
100 | .Ft BIGNUM * | ||
101 | .Fo ASN1_ENUMERATED_to_BN | ||
102 | .Fa "const ASN1_ENUMERATED *ai" | ||
103 | .Fa "BIGNUM *bn" | ||
104 | .Fc | ||
105 | .Sh DESCRIPTION | ||
106 | These functions convert to and from | ||
107 | .Vt ASN1_INTEGER | ||
108 | and | ||
109 | .Vt ASN1_ENUMERATED | ||
110 | objects. | ||
111 | .Pp | ||
112 | .Fn ASN1_INTEGER_get | ||
113 | converts | ||
114 | .Fa a | ||
115 | to the | ||
116 | .Vt long | ||
117 | type. | ||
118 | .Pp | ||
119 | .Fn ASN1_INTEGER_set | ||
120 | sets the value of | ||
121 | .Fa a | ||
122 | to | ||
123 | .Fa v . | ||
124 | .Pp | ||
125 | .Fn BN_to_ASN1_INTEGER | ||
126 | converts | ||
127 | .Fa bn | ||
128 | to an | ||
129 | .Vt ASN1_INTEGER . | ||
130 | If | ||
131 | .Fa ai | ||
132 | is | ||
133 | .Dv NULL , | ||
134 | a new | ||
135 | .Vt ASN1_INTEGER | ||
136 | object is returned. | ||
137 | Otherwise, the existing object | ||
138 | .Fa ai | ||
139 | is used instead. | ||
140 | .Pp | ||
141 | .Fn ASN1_INTEGER_to_BN | ||
142 | converts | ||
143 | .Fa ai | ||
144 | into a | ||
145 | .Vt BIGNUM . | ||
146 | If | ||
147 | .Fa bn | ||
148 | is | ||
149 | .Dv NULL , | ||
150 | a new | ||
151 | .Vt BIGNUM | ||
152 | object is returned. | ||
153 | Otherwise, the existing object | ||
154 | .Fa bn | ||
155 | is used instead. | ||
156 | .Pp | ||
157 | .Fn ASN1_ENUMERATED_get , | ||
158 | .Fn ASN1_ENUMERATED_set , | ||
159 | .Fn BN_to_ASN1_ENUMERATED , | ||
160 | and | ||
161 | .Fn ASN1_ENUMERATED_to_BN | ||
162 | behave like their | ||
163 | .Vt ASN1_INTEGER | ||
164 | counterparts except that they operate on an | ||
165 | .Vt ASN1_ENUMERATED | ||
166 | object. | ||
167 | .Sh RETURN VALUES | ||
168 | .Fn ASN1_INTEGER_get | ||
169 | and | ||
170 | .Fn ASN1_ENUMERATED_get | ||
171 | return the converted value, 0 if | ||
172 | .Fa a | ||
173 | is | ||
174 | .Dv NULL , | ||
175 | or \-1 on error, which is ambiguous because \-1 is a legitimate | ||
176 | value for an | ||
177 | .Vt ASN1_INTEGER . | ||
178 | .Pp | ||
179 | .Fn ASN1_INTEGER_set | ||
180 | and | ||
181 | .Fn ASN1_ENUMERATED_set | ||
182 | return 1 for success or 0 for failure. | ||
183 | They only fail if a memory allocation error occurs. | ||
184 | .Pp | ||
185 | .Fn BN_to_ASN1_INTEGER | ||
186 | and | ||
187 | .Fn BN_to_ASN1_ENUMERATED | ||
188 | return an | ||
189 | .Vt ASN1_INTEGER | ||
190 | or | ||
191 | .Vt ASN1_ENUMERATED | ||
192 | object, respectively, or | ||
193 | .Dv NULL | ||
194 | if an error occurs. | ||
195 | They only fail due to memory allocation errors. | ||
196 | .Pp | ||
197 | .Fn ASN1_INTEGER_to_BN | ||
198 | and | ||
199 | .Fn ASN1_ENUMERATED_to_BN | ||
200 | return a | ||
201 | .Vt BIGNUM | ||
202 | object of | ||
203 | .Dv NULL | ||
204 | if an error occurs. | ||
205 | They can fail if the passed type is incorrect (due to a programming error) | ||
206 | or due to memory allocation failures. | ||
207 | .Sh HISTORY | ||
208 | .Fn ASN1_INTEGER_set | ||
209 | first appeared in SSLeay 0.5.1. | ||
210 | .Fn ASN1_INTEGER_get , | ||
211 | .Fn BN_to_ASN1_INTEGER , | ||
212 | and | ||
213 | .Fn ASN1_INTEGER_to_BN | ||
214 | first appeared in SSLeay 0.6.0. | ||
215 | These functions have been available since | ||
216 | .Ox 2.3 . | ||
217 | .Pp | ||
218 | .Fn ASN1_ENUMERATED_get , | ||
219 | .Fn ASN1_ENUMERATED_set , | ||
220 | .Fn BN_to_ASN1_ENUMERATED , | ||
221 | and | ||
222 | .Fn ASN1_ENUMERATED_to_BN | ||
223 | first appeared in OpenSSL 0.9.2b and have been available since | ||
224 | .Ox 2.6 . | ||
225 | .Sh CAVEATS | ||
226 | In general an | ||
227 | .Vt ASN1_INTEGER | ||
228 | or | ||
229 | .Vt ASN1_ENUMERATED | ||
230 | type can contain an integer of almost arbitrary size | ||
231 | and so cannot always be represented by a C | ||
232 | .Vt long | ||
233 | type. | ||
234 | The ambiguous return values of | ||
235 | .Fn ASN1_INTEGER_get | ||
236 | and | ||
237 | .Fn ASN1_ENUMERATED_get | ||
238 | imply that these functions should be avoided if possible. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index c8e5d51fd6..fe5a87e608 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,9 +1,10 @@ | |||
1 | # $OpenBSD: Makefile,v 1.141 2018/04/18 01:13:37 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.142 2018/07/08 23:00:17 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
5 | MAN= \ | 5 | MAN= \ |
6 | ACCESS_DESCRIPTION_new.3 \ | 6 | ACCESS_DESCRIPTION_new.3 \ |
7 | ASN1_INTEGER_get.3 \ | ||
7 | ASN1_OBJECT_new.3 \ | 8 | ASN1_OBJECT_new.3 \ |
8 | ASN1_STRING_length.3 \ | 9 | ASN1_STRING_length.3 \ |
9 | ASN1_STRING_new.3 \ | 10 | ASN1_STRING_new.3 \ |