summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2021-11-23 14:58:08 +0000
committerschwarze <>2021-11-23 14:58:08 +0000
commit4f3472fc5bfb7c360db69e0795df95f0edeb055d (patch)
treef287e45eac83c46e28f645598a5e519e048dfe5b /src/lib
parent78eb35459b09366e67f2b74a1cc209dbbd6bc6a8 (diff)
downloadopenbsd-4f3472fc5bfb7c360db69e0795df95f0edeb055d.tar.gz
openbsd-4f3472fc5bfb7c360db69e0795df95f0edeb055d.tar.bz2
openbsd-4f3472fc5bfb7c360db69e0795df95f0edeb055d.zip
document ASN1_TYPE_set_octetstring(3) and ASN1_TYPE_get_octetstring(3)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/ASN1_TYPE_get.372
1 files changed, 67 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3
index 6a7d761f94..d4123cb3a9 100644
--- a/src/lib/libcrypto/man/ASN1_TYPE_get.3
+++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3
@@ -1,10 +1,10 @@
1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.13 2021/11/21 15:11:01 schwarze Exp $ 1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.14 2021/11/23 14:58:08 schwarze Exp $
2.\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400 2.\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license: 5.\" The changes are covered by the following Copyright and license:
6.\" 6.\"
7.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 7.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
8.\" 8.\"
9.\" Permission to use, copy, modify, and distribute this software for any 9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above 10.\" purpose with or without fee is hereby granted, provided that the above
@@ -65,7 +65,7 @@
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: November 21 2021 $ 68.Dd $Mdocdate: November 23 2021 $
69.Dt ASN1_TYPE_GET 3 69.Dt ASN1_TYPE_GET 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -74,6 +74,8 @@
74.Nm ASN1_TYPE_get , 74.Nm ASN1_TYPE_get ,
75.Nm ASN1_TYPE_set , 75.Nm ASN1_TYPE_set ,
76.Nm ASN1_TYPE_set1 , 76.Nm ASN1_TYPE_set1 ,
77.Nm ASN1_TYPE_set_octetstring ,
78.Nm ASN1_TYPE_get_octetstring ,
77.Nm ASN1_TYPE_cmp 79.Nm ASN1_TYPE_cmp
78.Nd ASN.1 objects of arbitrary type 80.Nd ASN.1 objects of arbitrary type
79.Sh SYNOPSIS 81.Sh SYNOPSIS
@@ -99,6 +101,18 @@
99.Fa "const void *value" 101.Fa "const void *value"
100.Fc 102.Fc
101.Ft int 103.Ft int
104.Fo ASN1_TYPE_set_octetstring
105.Fa "ASN1_TYPE *a"
106.Fa "const unsigned char *data"
107.Fa "int len"
108.Fc
109.Ft int
110.Fo ASN1_TYPE_get_octetstring
111.Fa "const ASN1_TYPE *a"
112.Fa "unsigned char *buffer"
113.Fa "int buflen"
114.Fc
115.Ft int
102.Fo ASN1_TYPE_cmp 116.Fo ASN1_TYPE_cmp
103.Fa "const ASN1_TYPE *a" 117.Fa "const ASN1_TYPE *a"
104.Fa "const ASN1_TYPE *b" 118.Fa "const ASN1_TYPE *b"
@@ -216,6 +230,33 @@ then the
216contains the entire ASN.1 encoding verbatim, including tag and 230contains the entire ASN.1 encoding verbatim, including tag and
217length octets. 231length octets.
218.Pp 232.Pp
233.Fn ASN1_TYPE_set_octetstring
234allocates a new
235.Vt ASN1_OCTET_STRING
236object, copies
237.Fa len
238bytes of
239.Fa data
240into it using
241.Xr ASN1_STRING_set 3 ,
242and replaces the value of
243.Fa a
244with it by calling
245.Fn ASN1_TYPE_set
246with a type of
247.Dv V_ASN1_OCTET_STRING .
248.Pp
249.Fn ASN1_TYPE_get_octetstring
250copies the contents of the
251.Vt ASN1_OCTET_STRING
252object contained in
253.Fa a ,
254but not more than
255.Fa buflen
256bytes, into the
257.Fa buffer
258provided by the caller.
259.Pp
219.Fn ASN1_TYPE_cmp 260.Fn ASN1_TYPE_cmp
220checks that 261checks that
221.Fa a 262.Fa a
@@ -269,7 +310,24 @@ newly constructed with
269.Fn ASN1_TYPE_new . 310.Fn ASN1_TYPE_new .
270.Pp 311.Pp
271.Fn ASN1_TYPE_set1 312.Fn ASN1_TYPE_set1
272returns 1 if the copying succeeds or 0 if it fails. 313and
314.Fn ASN1_TYPE_set_octetstring
315return 1 if the copying succeeds or 0 if it fails.
316.Pp
317.Fn ASN1_TYPE_get_octetstring
318returns the number of data bytes contained in the
319.Vt ASN1_OCTET_STRING
320object contained in
321.Fa a
322or \-1 if
323.Fa a
324is not of the type
325.Dv V_ASN1_OCTET_STRING
326or does not contain any object.
327If the return value is greater than the
328.Fa buflen
329argument, the content was truncated when copied to the
330.Fa buffer .
273.Pp 331.Pp
274.Fn ASN1_TYPE_cmp 332.Fn ASN1_TYPE_cmp
275returns 0 for a match or non-zero for a mismatch. 333returns 0 for a match or non-zero for a mismatch.
@@ -296,7 +354,11 @@ first appeared in SSLeay 0.5.1.
296.Fn ASN1_TYPE_get 354.Fn ASN1_TYPE_get
297and 355and
298.Fn ASN1_TYPE_set 356.Fn ASN1_TYPE_set
299first appeared in SSLeay 0.8.0. 357in SSLeay 0.8.0, and
358.Fn ASN1_TYPE_set_octetstring
359and
360.Fn ASN1_TYPE_get_octetstring
361in SSLeay 0.9.0.
300These functions have been available since 362These functions have been available since
301.Ox 2.4 . 363.Ox 2.4 .
302.Pp 364.Pp