From 6a844cf69ae4b0d31a8e2b18b94524ec66ec58df Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Tue, 24 Dec 2024 09:48:56 +0000 Subject: new manual page v2i_ASN1_BIT_STRING(3) written from scratch --- src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 | 7 +- src/lib/libcrypto/man/Makefile | 3 +- src/lib/libcrypto/man/X509V3_EXT_get_nid.3 | 5 +- src/lib/libcrypto/man/X509V3_parse_list.3 | 7 +- src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 | 5 +- src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 | 125 ++++++++++++++++++++++++++++ 6 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 (limited to 'src') diff --git a/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 b/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 index 5d863d19df..a916ca3ab2 100644 --- a/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 +++ b/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_BIT_STRING_set.3,v 1.4 2023/07/28 05:53:10 tb Exp $ +.\" $OpenBSD: ASN1_BIT_STRING_set.3,v 1.5 2024/12/24 09:48:56 schwarze Exp $ .\" .\" Copyright (c) 2021 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 28 2023 $ +.Dd $Mdocdate: December 24 2024 $ .Dt ASN1_BIT_STRING_SET 3 .Os .Sh NAME @@ -126,7 +126,8 @@ or if the requested bit is not set. .Sh SEE ALSO .Xr ASN1_BIT_STRING_new 3 , .Xr ASN1_STRING_set 3 , -.Xr d2i_ASN1_BIT_STRING 3 +.Xr d2i_ASN1_BIT_STRING 3 , +.Xr v2i_ASN1_BIT_STRING 3 .Sh HISTORY .Fn ASN1_BIT_STRING_set first appeared in SSLeay 0.6.5. diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index fef17409c7..4c7c5891eb 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.303 2024/12/23 08:39:57 schwarze Exp $ +# $OpenBSD: Makefile,v 1.304 2024/12/24 09:48:56 schwarze Exp $ .include @@ -426,6 +426,7 @@ MAN= \ lh_new.3 \ openssl.cnf.5 \ s2i_ASN1_INTEGER.3 \ + v2i_ASN1_BIT_STRING.3 \ x509v3.cnf.5 all clean cleandir depend includes obj tags: diff --git a/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 b/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 index fc0342d19b..ad153c36d0 100644 --- a/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 +++ b/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.7 2024/12/23 08:26:27 tb Exp $ +.\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.8 2024/12/24 09:48:56 schwarze Exp $ .\" .\" Copyright (c) 2024 Theo Buehler .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 23 2024 $ +.Dd $Mdocdate: December 24 2024 $ .Dt X509V3_EXT_GET_NID 3 .Os .Sh NAME @@ -69,6 +69,7 @@ if there is none. .Sh SEE ALSO .Xr i2s_ASN1_ENUMERATED_TABLE 3 , .Xr OBJ_create 3 , +.Xr v2i_ASN1_BIT_STRING 3 , .Xr X509_EXTENSION_get_object 3 , .Xr X509V3_get_d2i 3 .Sh STANDARDS diff --git a/src/lib/libcrypto/man/X509V3_parse_list.3 b/src/lib/libcrypto/man/X509V3_parse_list.3 index 7bb508ac7b..447f1a5e94 100644 --- a/src/lib/libcrypto/man/X509V3_parse_list.3 +++ b/src/lib/libcrypto/man/X509V3_parse_list.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: X509V3_parse_list.3,v 1.1 2024/12/23 08:39:57 schwarze Exp $ +.\" $OpenBSD: X509V3_parse_list.3,v 1.2 2024/12/24 09:48:56 schwarze Exp $ .\" .\" Copyright (c) 2024 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 23 2024 $ +.Dd $Mdocdate: December 24 2024 $ .Dt X509V3_PARSE_LIST 3 .Os .Sh NAME @@ -91,7 +91,8 @@ or if memory allocation fails. .Sh SEE ALSO .Xr isspace 3 , .Xr sk_pop_free 3 , -.Xr STACK_OF 3 +.Xr STACK_OF 3 , +.Xr v2i_ASN1_BIT_STRING 3 .Sh HISTORY .Fn X509V3_parse_list and diff --git a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 index 5455b5d224..0aae94e07d 100644 --- a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 +++ b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.7 2024/12/23 03:03:45 schwarze Exp $ +.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.8 2024/12/24 09:48:56 schwarze Exp $ .\" .\" Copyright (c) 2023 Theo Buehler .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 23 2024 $ +.Dd $Mdocdate: December 24 2024 $ .Dt S2I_ASN1_INTEGER 3 .Os .Sh NAME @@ -200,6 +200,7 @@ Error codes can sometimes be obtained by .Xr ASN1_INTEGER_to_BN 3 , .Xr ASN1_OCTET_STRING_new 3 , .Xr crypto 3 , +.Xr v2i_ASN1_BIT_STRING 3 , .Xr X509V3_get_d2i 3 .Sh HISTORY These functions first appeared in OpenSSL 0.9.4 and diff --git a/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 b/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 new file mode 100644 index 0000000000..36d9f7496b --- /dev/null +++ b/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 @@ -0,0 +1,125 @@ +.\" $OpenBSD: v2i_ASN1_BIT_STRING.3,v 1.1 2024/12/24 09:48:56 schwarze Exp $ +.\" +.\" Copyright (c) 2024 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: December 24 2024 $ +.Dt V2I_ASN1_BIT_STRING 3 +.Os +.Sh NAME +.Nm v2i_ASN1_BIT_STRING , +.Nm i2v_ASN1_BIT_STRING +.Nd ASN.1 BIT STRING utility functions for certificate extensions +.Sh SYNOPSIS +.In openssl/x509v3.h +.Ft ASN1_BIT_STRING * +.Fo v2i_ASN1_BIT_STRING +.Fa "X509V3_EXT_METHOD *method" +.Fa "X509V3_CTX *ctx" +.Fa "STACK_OF(CONF_VALUE) *nval" +.Fc +.Ft STACK_OF(CONF_VALUE) * +.Fo i2v_ASN1_BIT_STRING +.Fa "X509V3_EXT_METHOD *method" +.Fa "ASN1_BIT_STRING *bit_string" +.Fa "STACK_OF(CONF_VALUE) *nval" +.Fc +.Sh DESCRIPTION +.Fn v2i_ASN1_BIT_STRING +allocates a new ASN.1 +.Vt BIT STRING +object and initializes it from a list of bit names. +The +.Fa nval +argument is essentially used as the list of the names of the bits to set. +Both long names and short names can be used. +One name is taken from each element of +.Fa nval . +The +.Fa ctx +argument and any section names or values contained in the elements of +.Fa nval +are ignored. +To convert a C string containing a comma-separated list of names +to the input format of this function, +.Xr X509V3_parse_list 3 +can be used. +.Pp +.Fn i2v_ASN1_BIT_STRING +translates the numbers of the bits that are set in the +.Fa bit_string +to long names. +For each bit that is set, +one element containing the corresponding long name is added to +.Fa nval . +If a +.Dv NULL +pointer is passed for the +.Fa nval +argument, a new +.Vt STACK_OF(CONF_VALUE) +is allocated. +.Pp +For both functions, the +.Fa method +argument is only used for the translation of bit names to bit numbers +and vice versa. +Any names and bit numbers that do not occur in the +.Fa usr_data +translation table in the +.Fa method +are silently ignored. +.Pp +For the following arguments, +.Xr X509V3_EXT_get_nid 3 +returns static constant +.Fa method +objects supporting these functions: +.Pp +.Bl -tag -width NID_netscape_cert_type -compact +.It Dv NID_crl_reason +reason codes, RFC 5280 section 5.3.1 +.It Dv NID_key_usage +key usage purposes, RFC 5280 section 4.2.1.3 +.It Dv NID_netscape_cert_type +Netscape certificate types (obsolete) +.El +.Pp +While an application program could theoretically provide its own +.Fa method +object containing a custom translation table, that is unlikely to be +useful for any practical purpose. +.Sh RETURN VALUES +.Fn v2i_ASN1_BIT_STRING +returns the new +.Vt BIT STRING +object and +.Fn i2v_ASN1_BIT_STRING +the modified or new list of bit names. +Both functions return +.Dv NULL +if an error occurs, in particular if memory allocation fails. +.Sh SEE ALSO +.Xr ASN1_BIT_STRING_new 3 , +.Xr ASN1_BIT_STRING_set 3 , +.Xr i2s_ASN1_ENUMERATED_TABLE 3 , +.Xr STACK_OF 3 , +.Xr tls_peer_ocsp_crl_reason 3 , +.Xr X509_get_key_usage 3 , +.Xr X509V3_EXT_get_nid 3 , +.Xr X509V3_get_d2i 3 , +.Xr X509V3_parse_list 3 +.Sh HISTORY +These functions first appeared in OpenSSL 0.9.8 and have been available since +.Ox 4.5 . -- cgit v1.2.3-55-g6feb