From eb4902cfdf0b90f37195e895e898c6f4557cb5c1 Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 18 Dec 2021 17:47:44 +0000 Subject: [PATCH] new manual page OBJ_add_sigid(3) --- lib/libcrypto/man/ASN1_item_sign.3 | 5 +- lib/libcrypto/man/ASN1_item_verify.3 | 7 +- lib/libcrypto/man/Makefile | 3 +- lib/libcrypto/man/OBJ_NAME_add.3 | 5 +- lib/libcrypto/man/OBJ_add_sigid.3 | 124 ++++++++++++++++++ lib/libcrypto/man/OBJ_create.3 | 5 +- lib/libcrypto/man/OBJ_nid2obj.3 | 5 +- .../man/OpenSSL_add_all_algorithms.3 | 15 ++- lib/libcrypto/man/X509_signature_dump.3 | 5 +- 9 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 lib/libcrypto/man/OBJ_add_sigid.3 diff --git a/lib/libcrypto/man/ASN1_item_sign.3 b/lib/libcrypto/man/ASN1_item_sign.3 index 9dfc346fcc3..b47fd1d04d5 100644 --- a/lib/libcrypto/man/ASN1_item_sign.3 +++ b/lib/libcrypto/man/ASN1_item_sign.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_item_sign.3,v 1.1 2021/11/07 15:29:01 schwarze Exp $ +.\" $OpenBSD: ASN1_item_sign.3,v 1.2 2021/12/18 17:47:44 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: November 7 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt ASN1_ITEM_SIGN 3 .Os .Sh NAME @@ -116,6 +116,7 @@ is not fully initialized. .\" We do not provide EVP_PKEY_asn1_set_item(3). .\" .Xr EVP_PKEY_asn1_new 3 , .Xr EVP_PKEY_new 3 , +.Xr OBJ_find_sigid_by_algs 3 , .Xr X509_ALGOR_new 3 .Sh HISTORY .Fn ASN1_item_sign diff --git a/lib/libcrypto/man/ASN1_item_verify.3 b/lib/libcrypto/man/ASN1_item_verify.3 index 5d185185770..d2810879e37 100644 --- a/lib/libcrypto/man/ASN1_item_verify.3 +++ b/lib/libcrypto/man/ASN1_item_verify.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_item_verify.3,v 1.2 2021/11/26 13:48:21 jsg Exp $ +.\" $OpenBSD: ASN1_item_verify.3,v 1.3 2021/12/18 17:47:44 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: November 26 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt ASN1_ITEM_VERIFY 3 .Os .Sh NAME @@ -45,7 +45,7 @@ and verifies in a way similar to that .Fa sig_in contains a valid signature of the resulting byte array, -a signature that was created with the digest type +a signature that was created with the signature algorithm .Fa algor1 and the private key corresponding to the public key .Fa pkey . @@ -69,6 +69,7 @@ or does not work with the given .Xr ASN1_item_sign 3 , .Xr EVP_DigestVerify 3 , .Xr EVP_PKEY_new 3 , +.Xr OBJ_find_sigid_algs 3 , .Xr X509_ALGOR_new 3 .Sh HISTORY .Fn ASN1_item_verify diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index 9f9b152d124..79da1eb54f8 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.230 2021/12/17 17:56:14 schwarze Exp $ +# $OpenBSD: Makefile,v 1.231 2021/12/18 17:47:44 schwarze Exp $ .include @@ -207,6 +207,7 @@ MAN= \ MD5.3 \ NAME_CONSTRAINTS_new.3 \ OBJ_NAME_add.3 \ + OBJ_add_sigid.3 \ OBJ_create.3 \ OBJ_nid2obj.3 \ OCSP_CRLID_new.3 \ diff --git a/lib/libcrypto/man/OBJ_NAME_add.3 b/lib/libcrypto/man/OBJ_NAME_add.3 index 4fc4d566a76..4b1c39676fd 100644 --- a/lib/libcrypto/man/OBJ_NAME_add.3 +++ b/lib/libcrypto/man/OBJ_NAME_add.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: OBJ_NAME_add.3,v 1.1 2021/12/17 17:56:14 schwarze Exp $ +.\" $OpenBSD: OBJ_NAME_add.3,v 1.2 2021/12/18 17:47:45 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: December 17 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt OBJ_NAME_ADD 3 .Os .Sh NAME @@ -315,6 +315,7 @@ representing the new type or 0 if memory allocation fails. .Xr EVP_get_cipherbyname 3 , .Xr EVP_get_digestbyname 3 , .Xr lh_new 3 , +.Xr OBJ_add_sigid 3 , .Xr OBJ_create 3 , .Xr OBJ_nid2obj 3 .Sh BUGS diff --git a/lib/libcrypto/man/OBJ_add_sigid.3 b/lib/libcrypto/man/OBJ_add_sigid.3 new file mode 100644 index 00000000000..abfe825e88f --- /dev/null +++ b/lib/libcrypto/man/OBJ_add_sigid.3 @@ -0,0 +1,124 @@ +.\" $OpenBSD: OBJ_add_sigid.3,v 1.1 2021/12/18 17:47:45 schwarze Exp $ +.\" +.\" Copyright (c) 2021 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 18 2021 $ +.Dt OBJ_ADD_SIGID 3 +.Os +.Sh NAME +.Nm OBJ_add_sigid , +.Nm OBJ_sigid_free , +.Nm OBJ_find_sigid_algs , +.Nm OBJ_find_sigid_by_algs +.Nd signature algorithm mappings +.Sh SYNOPSIS +.In openssl/objects.h +.Ft int +.Fo OBJ_add_sigid +.Fa "int signature" +.Fa "int digest" +.Fa "int encryption" +.Fc +.Ft void +.Fn OBJ_sigid_free void +.Ft int +.Fo OBJ_find_sigid_algs +.Fa "int signature" +.Fa "int *pdigest" +.Fa "int *pencryption" +.Fc +.Ft int +.Fo OBJ_find_sigid_by_algs +.Fa "int *psignature" +.Fa "int digest" +.Fa "int encryption" +.Fc +.Sh DESCRIPTION +.Fn OBJ_add_sigid +defines the +.Fa signature +algorithm to use the specified +.Fa digest +and +.Fa encryption +algorithms. +Making sure that this does not conflict with earlier invocations of +.Fn OBJ_add_sigid +is the responsibility of the caller. +Definitions made with +.Fn OBJ_add_sigid +take precedence over definitions built into the library. +.Pp +.Fn OBJ_sigid_free +deletes all definitions made with +.Fn OBJ_add_sigid . +.Pp +.Fn OBJ_find_sigid_algs +looks up the +.Fa signature +algorithm. +If it is found, the associated digest algorithm is stored in +.Pf * Fa pdigest +unless +.Fa pdigest +is a +.Dv NULL +pointer, and the associated encryption algorithm is stored in +.Pf * Fa pencryption +unless +.Fa pencryption +is a +.Dv NULL +pointer. +.Pp +.Fn OBJ_find_sigid_by_algs +looks up the pair +.Pq Fa digest , encryption . +If it is found, the associated signature algorithm is stored in +.Pf * Fa psignature +unless +.Fa psignature +is a +.Dv NULL +pointer. +.Sh RETURN VALUES +.Fn OBJ_add_sigid +returns 1 on success or 0 if memory allocation fails. +.Pp +.Fn OBJ_find_sigid_algs +returns 1 if a definition of the +.Fa signature +algorithm is found or 0 if a definition of the +.Fa signature +algorithm is neither built into the library nor provided with +.Fn OBJ_add_sigid . +.Pp +.Fn OBJ_find_sigid_by_algs +returns 1 if a signature algorithm using the specified +.Fa digest +and +.Fa encryption +algorithms is defined or 0 if the definition of such an algorithm +is neither built into the library nor provided with +.Fn OBJ_add_sigid . +.Sh SEE ALSO +.Xr EVP_cleanup 3 , +.Xr OBJ_create 3 , +.Xr OBJ_NAME_add 3 , +.Xr OBJ_nid2obj 3 +.Sh HISTORY +These functions first appeared in OpenSSL 1.0.0 +and have been available since +.Ox 4.9 . diff --git a/lib/libcrypto/man/OBJ_create.3 b/lib/libcrypto/man/OBJ_create.3 index bc081a8c80c..1710d76e5a3 100644 --- a/lib/libcrypto/man/OBJ_create.3 +++ b/lib/libcrypto/man/OBJ_create.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: OBJ_create.3,v 1.4 2021/12/17 17:56:14 schwarze Exp $ +.\" $OpenBSD: OBJ_create.3,v 1.5 2021/12/18 17:47:45 schwarze Exp $ .\" full merge up to: .\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 .\" selective merge up to: @@ -69,7 +69,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: December 17 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt OBJ_CREATE 3 .Os .Sh NAME @@ -253,6 +253,7 @@ obj = OBJ_nid2obj(new_nid); .Sh SEE ALSO .Xr ASN1_OBJECT_new 3 , .Xr EVP_cleanup 3 , +.Xr OBJ_add_sigid 3 , .Xr OBJ_NAME_add 3 , .Xr OBJ_nid2obj 3 .Sh HISTORY diff --git a/lib/libcrypto/man/OBJ_nid2obj.3 b/lib/libcrypto/man/OBJ_nid2obj.3 index a337cedf18e..511bf8567a5 100644 --- a/lib/libcrypto/man/OBJ_nid2obj.3 +++ b/lib/libcrypto/man/OBJ_nid2obj.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: OBJ_nid2obj.3,v 1.17 2021/12/17 17:56:14 schwarze Exp $ +.\" $OpenBSD: OBJ_nid2obj.3,v 1.18 2021/12/18 17:47:45 schwarze Exp $ .\" full merge up to: OpenSSL c264592d May 14 11:28:00 2006 +0000 .\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 .\" @@ -67,7 +67,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: December 17 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt OBJ_NID2OBJ 3 .Os .Sh NAME @@ -389,6 +389,7 @@ obj = OBJ_txt2obj("1.2.3.4", 1); .Xr ASN1_OBJECT_new 3 , .Xr BIO_new 3 , .Xr d2i_ASN1_OBJECT 3 , +.Xr OBJ_add_sigid 3 , .Xr OBJ_create 3 , .Xr OBJ_NAME_add 3 .Sh HISTORY diff --git a/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 b/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 index f95c0713ef8..908b344f8a7 100644 --- a/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 +++ b/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.10 2021/12/17 17:56:14 schwarze Exp $ +.\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.11 2021/12/18 17:47:45 schwarze Exp $ .\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 .\" .\" This file was written by Dr. Stephen Henson . @@ -48,7 +48,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: December 17 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt OPENSSL_ADD_ALL_ALGORITHMS 3 .Os .Sh NAME @@ -100,15 +100,20 @@ only the first call has an effect. .Fn EVP_cleanup removes all ciphers and digests from the table and also calls .Xr OBJ_NAME_cleanup 3 -with an argument of \-1, thus resetting the global associative array -to its default state, removing all types, key-value pairs, and aliases -from it, including any that are unrelated to the EVP library. +with an argument of \-1 and +.Xr OBJ_sigid_free 3 , +thus resetting the global associative array of names +and all signature algorithm definitions to their default states, +removing all application-defined types, key-value pairs, aliases, +and signature algorithm definitions, +including any that are unrelated to the EVP library. .Sh SEE ALSO .Xr evp 3 , .Xr EVP_DigestInit 3 , .Xr EVP_EncryptInit 3 , .Xr OBJ_cleanup 3 , .Xr OBJ_NAME_add 3 , +.Xr OBJ_sigid_free 3 , .Xr OPENSSL_config 3 .Sh HISTORY .Fn EVP_cleanup diff --git a/lib/libcrypto/man/X509_signature_dump.3 b/lib/libcrypto/man/X509_signature_dump.3 index 8fff79ce898..bc41cc8b614 100644 --- a/lib/libcrypto/man/X509_signature_dump.3 +++ b/lib/libcrypto/man/X509_signature_dump.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: X509_signature_dump.3,v 1.1 2021/07/06 16:05:44 schwarze Exp $ +.\" $OpenBSD: X509_signature_dump.3,v 1.2 2021/12/18 17:47:45 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 6 2021 $ +.Dd $Mdocdate: December 18 2021 $ .Dt X509_SIGNATURE_DUMP 3 .Os .Sh NAME @@ -72,6 +72,7 @@ They fail and return as soon as any write operation fails. .Xr ASN1_STRING_print_ex 3 , .Xr BIO_new 3 , .Xr EVP_PKEY_asn1_new 3 , +.Xr OBJ_find_sigid_algs 3 , .Xr X509_ALGOR_new 3 , .Xr X509_get0_signature 3 .Sh HISTORY -- 2.20.1