diff options
author | schwarze <> | 2021-07-20 17:31:32 +0000 |
---|---|---|
committer | schwarze <> | 2021-07-20 17:31:32 +0000 |
commit | bf8b2c9ec0c609c82b5461ea29f83549dc7ac156 (patch) | |
tree | 8f0d83df36207aa8efa16b306c5f982ab3abf98e /src | |
parent | 0709cead32277189314b7dc1b11c3cae38813cae (diff) | |
download | openbsd-bf8b2c9ec0c609c82b5461ea29f83549dc7ac156.tar.gz openbsd-bf8b2c9ec0c609c82b5461ea29f83549dc7ac156.tar.bz2 openbsd-bf8b2c9ec0c609c82b5461ea29f83549dc7ac156.zip |
Split X509_NAME_hash(3) out of d2i_X509_NAME(3) and document
X509_issuer_name_hash(3), X509_subject_name_hash(3), and the _old variants.
Even though this is only tangentially related to decoding and encoding,
including a single function in d2i_X509_NAME(3) was probably OK,
but let's not bog down that page with six functions that are likely
to become obsolete at some point - even though right now, they are
still being used both internally and by external software.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_NAME_hash.3 | 94 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_NAME_new.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/d2i_X509_NAME.3 | 25 |
4 files changed, 102 insertions, 25 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 23a46ed318..c7375752bb 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.182 2021/07/19 13:16:43 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.183 2021/07/20 17:31:32 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -287,6 +287,7 @@ MAN= \ | |||
287 | X509_NAME_ENTRY_get_object.3 \ | 287 | X509_NAME_ENTRY_get_object.3 \ |
288 | X509_NAME_add_entry_by_txt.3 \ | 288 | X509_NAME_add_entry_by_txt.3 \ |
289 | X509_NAME_get_index_by_NID.3 \ | 289 | X509_NAME_get_index_by_NID.3 \ |
290 | X509_NAME_hash.3 \ | ||
290 | X509_NAME_new.3 \ | 291 | X509_NAME_new.3 \ |
291 | X509_NAME_print_ex.3 \ | 292 | X509_NAME_print_ex.3 \ |
292 | X509_OBJECT_get0_X509.3 \ | 293 | X509_OBJECT_get0_X509.3 \ |
diff --git a/src/lib/libcrypto/man/X509_NAME_hash.3 b/src/lib/libcrypto/man/X509_NAME_hash.3 new file mode 100644 index 0000000000..061de5c06c --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_hash.3 | |||
@@ -0,0 +1,94 @@ | |||
1 | .\" $OpenBSD: X509_NAME_hash.3,v 1.1 2021/07/20 17:31:32 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@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: July 20 2021 $ | ||
18 | .Dt X509_NAME_HASH 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm X509_NAME_hash , | ||
22 | .Nm X509_issuer_name_hash , | ||
23 | .Nm X509_subject_name_hash , | ||
24 | .Nm X509_NAME_hash_old , | ||
25 | .Nm X509_issuer_name_hash_old , | ||
26 | .Nm X509_subject_name_hash_old | ||
27 | .\" In the following line, "X.501" and "Name" are not typos. | ||
28 | .\" The "Name" type is defined in X.501, not in X.509. | ||
29 | .\" The type is called "Name" with capital "N", not "name". | ||
30 | .Nd calculate SHA-1 or MD5 hashes of X.501 Name objects | ||
31 | .Sh SYNOPSIS | ||
32 | .In openssl/x509.h | ||
33 | .Ft unsigned long | ||
34 | .Fn X509_NAME_hash "X509_NAME *name" | ||
35 | .Ft unsigned long | ||
36 | .Fn X509_issuer_name_hash "X509 *x" | ||
37 | .Ft unsigned long | ||
38 | .Fn X509_subject_name_hash "X509 *x" | ||
39 | .Ft unsigned long | ||
40 | .Fn X509_NAME_hash_old "X509_NAME *name" | ||
41 | .Ft unsigned long | ||
42 | .Fn X509_issuer_name_hash_old "X509 *x" | ||
43 | .Ft unsigned long | ||
44 | .Fn X509_subject_name_hash_old "X509 *x" | ||
45 | .Sh DESCRIPTION | ||
46 | .Fn X509_NAME_hash | ||
47 | calculates an | ||
48 | .Xr SHA1 3 | ||
49 | hash of the DER-encoded form of | ||
50 | .Fa name . | ||
51 | It is for example used by | ||
52 | .Xr X509_LOOKUP_hash_dir 3 | ||
53 | to locate certificate files in the file system. | ||
54 | .Pp | ||
55 | .Fn X509_issuer_name_hash | ||
56 | and | ||
57 | .Fn X509_subject_name_hash | ||
58 | are wrappers to calculate this hash of the issuer or subject name of | ||
59 | .Fa x , | ||
60 | respectively. | ||
61 | .Pp | ||
62 | .Fn X509_NAME_hash_old , | ||
63 | .Fn X509_issuer_name_hash_old , | ||
64 | and | ||
65 | .Fn X509_subject_name_hash_old | ||
66 | are variants that use MD5 instead of SHA-1. | ||
67 | .Sh RETURN VALUES | ||
68 | These functions return the hash value or 0 if an error occurs. | ||
69 | .Sh SEE ALSO | ||
70 | .Xr i2d_X509_NAME 3 , | ||
71 | .Xr X509_get_subject_name 3 , | ||
72 | .Xr X509_NAME_digest 3 , | ||
73 | .Xr X509_NAME_new 3 | ||
74 | .Sh HISTORY | ||
75 | .Fn X509_subject_name_hash | ||
76 | first appeared in SSLeay 0.4.0, | ||
77 | .Fn X509_issuer_name_hash | ||
78 | in SSLeay 0.5.1, and | ||
79 | .Fn X509_NAME_hash | ||
80 | in SSLeay 0.8.0. | ||
81 | They were switched to hashing the DER representation of the name | ||
82 | rather than an ASCII rendering in SSLeay 0.9.0 and have all been | ||
83 | available since | ||
84 | .Ox 2.4 . | ||
85 | .Pp | ||
86 | They were switched to using SHA1 instead of MD5 in OpenSSL 1.0.0 and in | ||
87 | .Ox 4.9 . | ||
88 | .Pp | ||
89 | .Fn X509_NAME_hash_old , | ||
90 | .Fn X509_issuer_name_hash_old , | ||
91 | and | ||
92 | .Fn X509_subject_name_hash_old | ||
93 | first appeared in OpenSSL 1.0.0 and have been available since | ||
94 | .Ox 4.9 . | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_new.3 b/src/lib/libcrypto/man/X509_NAME_new.3 index 5895dd5a10..3a4786a9ae 100644 --- a/src/lib/libcrypto/man/X509_NAME_new.3 +++ b/src/lib/libcrypto/man/X509_NAME_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: X509_NAME_new.3,v 1.8 2019/08/20 13:27:19 schwarze Exp $ | 1 | .\" $OpenBSD: X509_NAME_new.3,v 1.9 2021/07/20 17:31:32 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
4 | .\" | 4 | .\" |
@@ -14,7 +14,7 @@ | |||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | .\" | 16 | .\" |
17 | .Dd $Mdocdate: August 20 2019 $ | 17 | .Dd $Mdocdate: July 20 2021 $ |
18 | .Dt X509_NAME_NEW 3 | 18 | .Dt X509_NAME_NEW 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
@@ -85,6 +85,7 @@ if an error occurred. | |||
85 | .Xr X509_NAME_digest 3 , | 85 | .Xr X509_NAME_digest 3 , |
86 | .Xr X509_NAME_ENTRY_new 3 , | 86 | .Xr X509_NAME_ENTRY_new 3 , |
87 | .Xr X509_NAME_get_index_by_NID 3 , | 87 | .Xr X509_NAME_get_index_by_NID 3 , |
88 | .Xr X509_NAME_hash 3 , | ||
88 | .Xr X509_NAME_print_ex 3 , | 89 | .Xr X509_NAME_print_ex 3 , |
89 | .Xr X509_new 3 | 90 | .Xr X509_new 3 |
90 | .Sh STANDARDS | 91 | .Sh STANDARDS |
diff --git a/src/lib/libcrypto/man/d2i_X509_NAME.3 b/src/lib/libcrypto/man/d2i_X509_NAME.3 index c2d4b7d1cd..6e3e4a7f69 100644 --- a/src/lib/libcrypto/man/d2i_X509_NAME.3 +++ b/src/lib/libcrypto/man/d2i_X509_NAME.3 | |||
@@ -1,9 +1,9 @@ | |||
1 | .\" $OpenBSD: d2i_X509_NAME.3,v 1.15 2021/07/03 17:04:51 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_X509_NAME.3,v 1.16 2021/07/20 17:31:32 schwarze Exp $ |
2 | .\" checked up to: | 2 | .\" checked up to: |
3 | .\" OpenSSL crypto/d2i_X509_NAME 4692340e Jun 7 15:49:08 2016 -0400 and | 3 | .\" OpenSSL crypto/d2i_X509_NAME 4692340e Jun 7 15:49:08 2016 -0400 and |
4 | .\" OpenSSL man3/X509_NAME_get0_der 99d63d46 Oct 26 13:56:48 2016 -0400 | 4 | .\" OpenSSL man3/X509_NAME_get0_der 99d63d46 Oct 26 13:56:48 2016 -0400 |
5 | .\" | 5 | .\" |
6 | .\" Copyright (c) 2016, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> | 6 | .\" Copyright (c) 2016, 2018 Ingo Schwarze <schwarze@openbsd.org> |
7 | .\" | 7 | .\" |
8 | .\" Permission to use, copy, modify, and distribute this software for any | 8 | .\" Permission to use, copy, modify, and distribute this software for any |
9 | .\" purpose with or without fee is hereby granted, provided that the above | 9 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -17,7 +17,7 @@ | |||
17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | .\" | 19 | .\" |
20 | .Dd $Mdocdate: July 3 2021 $ | 20 | .Dd $Mdocdate: July 20 2021 $ |
21 | .Dt D2I_X509_NAME 3 | 21 | .Dt D2I_X509_NAME 3 |
22 | .Os | 22 | .Os |
23 | .Sh NAME | 23 | .Sh NAME |
@@ -26,7 +26,6 @@ | |||
26 | .Nm X509_NAME_get0_der , | 26 | .Nm X509_NAME_get0_der , |
27 | .Nm X509_NAME_dup , | 27 | .Nm X509_NAME_dup , |
28 | .Nm X509_NAME_set , | 28 | .Nm X509_NAME_set , |
29 | .Nm X509_NAME_hash , | ||
30 | .Nm d2i_X509_NAME_ENTRY , | 29 | .Nm d2i_X509_NAME_ENTRY , |
31 | .Nm i2d_X509_NAME_ENTRY , | 30 | .Nm i2d_X509_NAME_ENTRY , |
32 | .Nm X509_NAME_ENTRY_dup | 31 | .Nm X509_NAME_ENTRY_dup |
@@ -62,10 +61,6 @@ | |||
62 | .Fa "X509_NAME **val_out" | 61 | .Fa "X509_NAME **val_out" |
63 | .Fa "X509_NAME *val_in" | 62 | .Fa "X509_NAME *val_in" |
64 | .Fc | 63 | .Fc |
65 | .Ft unsigned long | ||
66 | .Fo X509_NAME_hash | ||
67 | .Fa "X509_NAME *val_in" | ||
68 | .Fc | ||
69 | .Ft X509_NAME_ENTRY * | 64 | .Ft X509_NAME_ENTRY * |
70 | .Fo d2i_X509_NAME_ENTRY | 65 | .Fo d2i_X509_NAME_ENTRY |
71 | .Fa "X509_NAME_ENTRY **val_out" | 66 | .Fa "X509_NAME_ENTRY **val_out" |
@@ -142,15 +137,6 @@ remains valid and may or may not be the same pointer as | |||
142 | .Pf * Fa val_out | 137 | .Pf * Fa val_out |
143 | after the call. | 138 | after the call. |
144 | .Pp | 139 | .Pp |
145 | .Fn X509_NAME_hash | ||
146 | calculates a | ||
147 | .Xr SHA1 3 | ||
148 | hash of the DER-encoded form of the name | ||
149 | .Pf * Fa val_in . | ||
150 | It is for example used by | ||
151 | .Xr X509_LOOKUP_hash_dir 3 | ||
152 | to locate certificate files in the file system. | ||
153 | .Pp | ||
154 | .Fn d2i_X509_NAME_ENTRY | 140 | .Fn d2i_X509_NAME_ENTRY |
155 | and | 141 | and |
156 | .Fn i2d_X509_NAME_ENTRY | 142 | .Fn i2d_X509_NAME_ENTRY |
@@ -180,9 +166,6 @@ and | |||
180 | .Fn X509_NAME_get0_der | 166 | .Fn X509_NAME_get0_der |
181 | return 1 on success or 0 if an error occurs. | 167 | return 1 on success or 0 if an error occurs. |
182 | .Pp | 168 | .Pp |
183 | .Fn X509_NAME_hash | ||
184 | returns the hash value or 0 if an error occurs. | ||
185 | .Pp | ||
186 | .Fn d2i_X509_NAME_ENTRY | 169 | .Fn d2i_X509_NAME_ENTRY |
187 | and | 170 | and |
188 | .Fn X509_NAME_ENTRY_dup | 171 | .Fn X509_NAME_ENTRY_dup |
@@ -221,8 +204,6 @@ and | |||
221 | .Fn X509_NAME_ENTRY_dup | 204 | .Fn X509_NAME_ENTRY_dup |
222 | first appeared in SSLeay 0.5.1. | 205 | first appeared in SSLeay 0.5.1. |
223 | .Fn X509_NAME_set | 206 | .Fn X509_NAME_set |
224 | and | ||
225 | .Fn X509_NAME_hash | ||
226 | first appeared in SSLeay 0.8.0. | 207 | first appeared in SSLeay 0.8.0. |
227 | These functions have been available since | 208 | These functions have been available since |
228 | .Ox 2.4 . | 209 | .Ox 2.4 . |