summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2021-11-23 17:53:59 +0000
committerschwarze <>2021-11-23 17:53:59 +0000
commit864e945e483e981f62ef5b6d8658b1c4ed310b90 (patch)
tree995b5cbfeb255a4fe6a38ec68e3d3eecd5cc24b3 /src/lib
parenta5226e473caa4f9f38500526782e41fc5069c371 (diff)
downloadopenbsd-864e945e483e981f62ef5b6d8658b1c4ed310b90.tar.gz
openbsd-864e945e483e981f62ef5b6d8658b1c4ed310b90.tar.bz2
openbsd-864e945e483e981f62ef5b6d8658b1c4ed310b90.zip
document ASN1_TYPE_set_int_octetstring(3) and ASN1_TYPE_get_int_octetstring(3)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/ASN1_TYPE_get.386
1 files changed, 77 insertions, 9 deletions
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3
index d4123cb3a9..1a80ddccbc 100644
--- a/src/lib/libcrypto/man/ASN1_TYPE_get.3
+++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3
@@ -1,5 +1,5 @@
1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.14 2021/11/23 14:58:08 schwarze Exp $ 1.\" $OpenBSD: ASN1_TYPE_get.3,v 1.15 2021/11/23 17:53:59 schwarze Exp $
2.\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400 2.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
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:
@@ -76,6 +76,8 @@
76.Nm ASN1_TYPE_set1 , 76.Nm ASN1_TYPE_set1 ,
77.Nm ASN1_TYPE_set_octetstring , 77.Nm ASN1_TYPE_set_octetstring ,
78.Nm ASN1_TYPE_get_octetstring , 78.Nm ASN1_TYPE_get_octetstring ,
79.Nm ASN1_TYPE_set_int_octetstring ,
80.Nm ASN1_TYPE_get_int_octetstring ,
79.Nm ASN1_TYPE_cmp 81.Nm ASN1_TYPE_cmp
80.Nd ASN.1 objects of arbitrary type 82.Nd ASN.1 objects of arbitrary type
81.Sh SYNOPSIS 83.Sh SYNOPSIS
@@ -113,6 +115,20 @@
113.Fa "int buflen" 115.Fa "int buflen"
114.Fc 116.Fc
115.Ft int 117.Ft int
118.Fo ASN1_TYPE_set_int_octetstring
119.Fa "ASN1_TYPE *a"
120.Fa "long num"
121.Fa "const unsigned char *data"
122.Fa "int len"
123.Fc
124.Ft int
125.Fo ASN1_TYPE_get_int_octetstring
126.Fa "const ASN1_TYPE *a",
127.Fa "long *num"
128.Fa "unsigned char *buffer",
129.Fa "int buflen"
130.Fc
131.Ft int
116.Fo ASN1_TYPE_cmp 132.Fo ASN1_TYPE_cmp
117.Fa "const ASN1_TYPE *a" 133.Fa "const ASN1_TYPE *a"
118.Fa "const ASN1_TYPE *b" 134.Fa "const ASN1_TYPE *b"
@@ -257,6 +273,40 @@ bytes, into the
257.Fa buffer 273.Fa buffer
258provided by the caller. 274provided by the caller.
259.Pp 275.Pp
276.Fn ASN1_TYPE_set_int_octetstring
277frees the value contained in
278.Fa a ,
279if any, sets its type to
280.Dv V_ASN1_SEQUENCE ,
281and sets its value to a two-element ASN.1 sequence consisting of
282an ASN.1 INTEGER object with the value
283.Fa num
284and an ASN.1 OCTET STRING object
285containing a copy of the
286.Fa len
287bytes pointed to by
288.Fa data .
289.Pp
290.Fn ASN1_TYPE_get_int_octetstring
291copies the integer value from the first element of the ASN.1 sequence
292.Fa a
293to
294.Pf * Fa num
295unless
296.Fa num
297is a
298.Dv NULL
299pointer and copies the octet string value from the second elememt,
300but not more than
301.Fa buflen
302bytes, into the
303.Fa buffer
304provided by the caller unless
305.Fa buffer
306is a
307.Dv NULL
308pointer.
309.Pp
260.Fn ASN1_TYPE_cmp 310.Fn ASN1_TYPE_cmp
261checks that 311checks that
262.Fa a 312.Fa a
@@ -283,7 +333,7 @@ the two types could be absent OPTIONAL fields and so should match,
283however passing 333however passing
284.Dv NULL 334.Dv NULL
285values could also indicate a programming error (for example an 335values could also indicate a programming error (for example an
286unparseable type which returns 336unparsable type which returns
287.Dv NULL ) 337.Dv NULL )
288for types which do 338for types which do
289.Sy not 339.Sy not
@@ -309,10 +359,11 @@ For example, it will always happen for empty objects
309newly constructed with 359newly constructed with
310.Fn ASN1_TYPE_new . 360.Fn ASN1_TYPE_new .
311.Pp 361.Pp
312.Fn ASN1_TYPE_set1 362.Fn ASN1_TYPE_set1 ,
363.Fn ASN1_TYPE_set_octetstring ,
313and 364and
314.Fn ASN1_TYPE_set_octetstring 365.Fn ASN1_TYPE_set_int_octetstring
315return 1 if the copying succeeds or 0 if it fails. 366return 1 on success or 0 on failure.
316.Pp 367.Pp
317.Fn ASN1_TYPE_get_octetstring 368.Fn ASN1_TYPE_get_octetstring
318returns the number of data bytes contained in the 369returns the number of data bytes contained in the
@@ -329,6 +380,21 @@ If the return value is greater than the
329argument, the content was truncated when copied to the 380argument, the content was truncated when copied to the
330.Fa buffer . 381.Fa buffer .
331.Pp 382.Pp
383.Fn ASN1_TYPE_get_int_octetstring
384returns the number of data bytes contained in the
385.Vt ASN1_OCTET_STRING
386object that is the second element of the ASN.1 sequence
387.Fa a
388or \-1 if
389.Fa a
390is not of the type
391.Dv V_ASN1_SEQUENCE
392or if decoding fails.
393If the return value is greater than the
394.Fa buflen
395argument, the content was truncated when copied to the
396.Fa buffer .
397.Pp
332.Fn ASN1_TYPE_cmp 398.Fn ASN1_TYPE_cmp
333returns 0 for a match or non-zero for a mismatch. 399returns 0 for a match or non-zero for a mismatch.
334.Sh SEE ALSO 400.Sh SEE ALSO
@@ -350,14 +416,16 @@ returns 0 for a match or non-zero for a mismatch.
350.Fn ASN1_TYPE_new 416.Fn ASN1_TYPE_new
351and 417and
352.Fn ASN1_TYPE_free 418.Fn ASN1_TYPE_free
353first appeared in SSLeay 0.5.1. 419first appeared in SSLeay 0.5.1,
354.Fn ASN1_TYPE_get 420.Fn ASN1_TYPE_get
355and 421and
356.Fn ASN1_TYPE_set 422.Fn ASN1_TYPE_set
357in SSLeay 0.8.0, and 423in SSLeay 0.8.0, and
358.Fn ASN1_TYPE_set_octetstring 424.Fn ASN1_TYPE_set_octetstring ,
425.Fn ASN1_TYPE_get_octetstring ,
426.Fn ASN1_TYPE_set_int_octetstring ,
359and 427and
360.Fn ASN1_TYPE_get_octetstring 428.Fn ASN1_TYPE_get_int_octetstring
361in SSLeay 0.9.0. 429in SSLeay 0.9.0.
362These functions have been available since 430These functions have been available since
363.Ox 2.4 . 431.Ox 2.4 .