summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-08-25 05:29:35 +0000
committertb <>2023-08-25 05:29:35 +0000
commit0415126d1cd7a26e02d2feb3f3e0298779fb8fc6 (patch)
tree73117dbeba72085b9c08a1621c22ea4f62f16f12 /src/lib
parentd302310b03dcccfcc743c39ce6b09bb80e6b6bf6 (diff)
downloadopenbsd-0415126d1cd7a26e02d2feb3f3e0298779fb8fc6.tar.gz
openbsd-0415126d1cd7a26e02d2feb3f3e0298779fb8fc6.tar.bz2
openbsd-0415126d1cd7a26e02d2feb3f3e0298779fb8fc6.zip
Document EVP_add_{cipher,digest} and friends
These and EVP_{add,remove}_{cipher,digest}_alias() are mostly for internal use.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/EVP_add_cipher.3158
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/evp.35
3 files changed, 163 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/EVP_add_cipher.3 b/src/lib/libcrypto/man/EVP_add_cipher.3
new file mode 100644
index 0000000000..ff43129259
--- /dev/null
+++ b/src/lib/libcrypto/man/EVP_add_cipher.3
@@ -0,0 +1,158 @@
1.\" $OpenBSD: EVP_add_cipher.3,v 1.1 2023/08/25 05:29:35 tb Exp $
2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: August 25 2023 $
18.Dt EVP_ADD_CIPHER 3
19.Os
20.Sh NAME
21.Nm EVP_add_cipher ,
22.Nm EVP_add_cipher_alias ,
23.Nm EVP_delete_cipher_alias ,
24.Nm EVP_add_digest ,
25.Nm EVP_add_cipher_alias ,
26.Nm EVP_delete_cipher_alias
27.Nd maintain cipher and digest lookup by names
28.Sh SYNOPSIS
29.In openssl/evp.h
30.Ft int
31.Fo EVP_add_cipher
32.Fa "const EVP_CIPHER *cipher"
33.Fc
34.Ft int
35.Fo EVP_add_cipher_alias
36.Fa "const char *name"
37.Fa "const char *alias"
38.Fc
39.Ft int
40.Fo EVP_remove_cipher_alias
41.Fa "const char *name"
42.Fa "const char *alias"
43.Fc
44.Ft int
45.Fo EVP_add_digest
46.Fa "const EVP_MD *md"
47.Fc
48.Ft int
49.Fo EVP_add_digest_alias
50.Fa "const char *name"
51.Fa "const char *alias"
52.Fc
53.Ft int
54.Fo EVP_remove_digest_alias
55.Fa "const char *name"
56.Fa "const char *alias"
57.Fc
58.Sh DESCRIPTION
59.Fn EVP_add_cipher
60adds
61.Fa cipher
62to a global lookup table so that it can be retrieved with
63.Xr EVP_get_cipherbyname 3
64using both its long and short names,
65as determined by the
66.Fa cipher Ns 's
67NID via
68.Xr OBJ_nid2ln 3
69and
70.Xr OBJ_nid2sn 3 .
71It is the caller's responsibility to ensure that the long
72and short names are not
73.Dv NULL .
74Internally, the lookup table is the global associative array and
75.Xr OBJ_NAME_add 3
76is used to add two key-value pairs with value pointer
77.Fa cipher
78and the keys consisting of the names and
79the type
80.Dv OBJ_NAME_TYPE_CIPHER_METH .
81.Pp
82.Fn EVP_add_cipher_alias
83and
84.Fn EVP_remove_cipher_alias
85add and remove the
86.Fa alias
87for the cipher
88.Fa name .
89They are implemented as macros.
90.Pp
91.Fn EVP_add_digest
92adds
93.Fa md
94to a global lookup table so that it can be retrieved with
95.Xr EVP_get_digestbyname 3
96using both its long and short names,
97as determined by the
98.Fa md Ns 's
99NID via
100.Xr OBJ_nid2ln 3
101and
102.Xr OBJ_nid2sn 3 .
103If the
104.Fa md
105has an associated public key signing algorithm (see
106.Xr EVP_MD_pkey_type 3 )
107distinct from the
108.Fa md Ns 's
109NID, the signing algorithm's short and long names are added as aliases for
110the short name of
111.Fa md .
112It is the caller's responsibility to ensure that the long
113and short names are not
114.Dv NULL .
115Internally, the lookup table is the global associative array and
116.Xr OBJ_NAME_add 3
117is used to add two key-value pairs with value pointer
118.Fa md
119and the keys consisting of the names and
120the type
121.Dv OBJ_NAME_TYPE_MD_METH .
122The aliases are added with
123.Fn EVP_add_digest_alias .
124.Pp
125.Fn EVP_add_digest_alias
126and
127.Fn EVP_remove_digest_alias
128add and remove the
129.Fa alias
130for the digest
131.Fa name .
132They are implemented as macros.
133.Sh RETURN VALUES
134These functions return 1 on success and 0 on failure.
135.Sh SEE ALSO
136.Xr EVP_CIPHER_meth_new 3 ,
137.Xr EVP_get_cipherbyname 3 ,
138.Xr EVP_get_digestbyname 3 ,
139.Xr EVP_MD_meth_new 3 ,
140.Xr OBJ_create 3 ,
141.Xr OBJ_NAME_add 3
142.Sh HISTORY
143.Fn EVP_add_cipher
144and
145.Fn EVP_add_digest
146first appeared in OpenSSL 0.9.0 and have been available since
147.Ox 2.4 .
148.Pp
149.Fn EVP_add_cipher_alias ,
150.Fn EVP_delete_cipher_alias ,
151.Fn EVP_add_cipher_alias ,
152and
153.Fn EVP_delete_cipher_alias
154first appeared in OpenSSL 0.9.4 and have been available since
155.Ox 2.6 .
156.Sh BUGS
157Key-value pairs already added before an error occurred
158remain in the global associative array.
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 9af9d28c4f..27e64c494f 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.261 2023/08/15 11:26:49 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.262 2023/08/25 05:29:35 tb Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -198,6 +198,7 @@ MAN= \
198 EVP_SealInit.3 \ 198 EVP_SealInit.3 \
199 EVP_SignInit.3 \ 199 EVP_SignInit.3 \
200 EVP_VerifyInit.3 \ 200 EVP_VerifyInit.3 \
201 EVP_add_cipher.3 \
201 EVP_aes_128_cbc.3 \ 202 EVP_aes_128_cbc.3 \
202 EVP_camellia_128_cbc.3 \ 203 EVP_camellia_128_cbc.3 \
203 EVP_chacha20.3 \ 204 EVP_chacha20.3 \
diff --git a/src/lib/libcrypto/man/evp.3 b/src/lib/libcrypto/man/evp.3
index 36f0e07003..02e21b8570 100644
--- a/src/lib/libcrypto/man/evp.3
+++ b/src/lib/libcrypto/man/evp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: evp.3,v 1.17 2023/08/15 11:26:49 schwarze Exp $ 1.\" $OpenBSD: evp.3,v 1.18 2023/08/25 05:29:35 tb Exp $
2.\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>, 4.\" This file was written by Ulf Moeller <ulf@openssl.org>,
@@ -51,7 +51,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: August 15 2023 $ 54.Dd $Mdocdate: August 25 2023 $
55.Dt EVP 3 55.Dt EVP 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
@@ -194,6 +194,7 @@ operations are more efficient using the high-level interfaces.
194.Xr ENGINE_get_cipher 3 , 194.Xr ENGINE_get_cipher 3 ,
195.Xr ENGINE_register_RSA 3 , 195.Xr ENGINE_register_RSA 3 ,
196.Xr EVP_AEAD_CTX_init 3 , 196.Xr EVP_AEAD_CTX_init 3 ,
197.Xr EVP_add_cipher 3 ,
197.Xr EVP_aes_128_cbc 3 , 198.Xr EVP_aes_128_cbc 3 ,
198.Xr EVP_BytesToKey 3 , 199.Xr EVP_BytesToKey 3 ,
199.Xr EVP_camellia_128_cbc 3 , 200.Xr EVP_camellia_128_cbc 3 ,