diff options
author | schwarze <> | 2021-12-16 16:36:16 +0000 |
---|---|---|
committer | schwarze <> | 2021-12-16 16:36:16 +0000 |
commit | a197720acac52b881b0542a01897b7580864a476 (patch) | |
tree | 695eb30ac77be718dba72f3d99f24df56a0e49bb | |
parent | 47b76397d6e0cea4b34482a213fd69be75baf6ad (diff) | |
download | openbsd-a197720acac52b881b0542a01897b7580864a476.tar.gz openbsd-a197720acac52b881b0542a01897b7580864a476.tar.bz2 openbsd-a197720acac52b881b0542a01897b7580864a476.zip |
document obj_cleanup_defer(3) and check_defer(3)
-rw-r--r-- | src/lib/libcrypto/man/OBJ_create.3 | 75 | ||||
-rw-r--r-- | src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 | 5 |
2 files changed, 72 insertions, 8 deletions
diff --git a/src/lib/libcrypto/man/OBJ_create.3 b/src/lib/libcrypto/man/OBJ_create.3 index e79ef90853..0a91fc8655 100644 --- a/src/lib/libcrypto/man/OBJ_create.3 +++ b/src/lib/libcrypto/man/OBJ_create.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: OBJ_create.3,v 1.2 2021/12/15 22:20:12 schwarze Exp $ | 1 | .\" $OpenBSD: OBJ_create.3,v 1.3 2021/12/16 16:36:16 schwarze Exp $ |
2 | .\" full merge up to: | 2 | .\" full merge up to: |
3 | .\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 | 3 | .\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 |
4 | .\" selective merge up to: | 4 | .\" selective merge up to: |
@@ -7,7 +7,7 @@ | |||
7 | .\" This file is a derived work. | 7 | .\" This file is a derived work. |
8 | .\" The changes are covered by the following Copyright and license: | 8 | .\" The changes are covered by the following Copyright and license: |
9 | .\" | 9 | .\" |
10 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 10 | .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> |
11 | .\" | 11 | .\" |
12 | .\" Permission to use, copy, modify, and distribute this software for any | 12 | .\" Permission to use, copy, modify, and distribute this software for any |
13 | .\" purpose with or without fee is hereby granted, provided that the above | 13 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -69,7 +69,7 @@ | |||
69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
71 | .\" | 71 | .\" |
72 | .Dd $Mdocdate: December 15 2021 $ | 72 | .Dd $Mdocdate: December 16 2021 $ |
73 | .Dt OBJ_CREATE 3 | 73 | .Dt OBJ_CREATE 3 |
74 | .Os | 74 | .Os |
75 | .Sh NAME | 75 | .Sh NAME |
@@ -78,7 +78,9 @@ | |||
78 | .Nm OBJ_create , | 78 | .Nm OBJ_create , |
79 | .\" OBJ_create_and_add_object is a deprecated, unused alias for OBJ_create(3). | 79 | .\" OBJ_create_and_add_object is a deprecated, unused alias for OBJ_create(3). |
80 | .Nm OBJ_create_objects , | 80 | .Nm OBJ_create_objects , |
81 | .Nm OBJ_cleanup | 81 | .Nm obj_cleanup_defer , |
82 | .Nm OBJ_cleanup , | ||
83 | .Nm check_defer | ||
82 | .Nd modify the table of ASN.1 object identifiers | 84 | .Nd modify the table of ASN.1 object identifiers |
83 | .Sh SYNOPSIS | 85 | .Sh SYNOPSIS |
84 | .In openssl/objects.h | 86 | .In openssl/objects.h |
@@ -94,8 +96,11 @@ | |||
94 | .Fc | 96 | .Fc |
95 | .Ft int | 97 | .Ft int |
96 | .Fn OBJ_create_objects "BIO *in_bio" | 98 | .Fn OBJ_create_objects "BIO *in_bio" |
99 | .Vt extern int obj_cleanup_defer ; | ||
97 | .Ft void | 100 | .Ft void |
98 | .Fn OBJ_cleanup void | 101 | .Fn OBJ_cleanup void |
102 | .Ft void | ||
103 | .Fn check_defer "int nid" | ||
99 | .Sh DESCRIPTION | 104 | .Sh DESCRIPTION |
100 | .Fn OBJ_new_nid | 105 | .Fn OBJ_new_nid |
101 | returns the smallest currently unassigned ASN.1 numeric | 106 | returns the smallest currently unassigned ASN.1 numeric |
@@ -149,13 +154,64 @@ or a similar function and then calling | |||
149 | .Xr ASN1_OBJECT_free 3 | 154 | .Xr ASN1_OBJECT_free 3 |
150 | on the returned pointer will have no effect. | 155 | on the returned pointer will have no effect. |
151 | .Pp | 156 | .Pp |
157 | The global variable | ||
158 | .Va obj_cleanup_defer | ||
159 | controls the behaviour of | ||
160 | .Fn OBJ_cleanup | ||
161 | and | ||
162 | .Xr EVP_cleanup 3 . | ||
163 | .Pp | ||
164 | If | ||
165 | .Va obj_cleanup_defer | ||
166 | has the default value of 0, | ||
152 | .Fn OBJ_cleanup | 167 | .Fn OBJ_cleanup |
153 | cleans up the internal object table: this should be called before | 168 | resets the internal object table to its default state, |
154 | an application exits if any new objects were added using | 169 | removing and freeing all objects that were added with |
155 | .Fn OBJ_add_object , | 170 | .Fn OBJ_add_object , |
156 | .Fn OBJ_create , | 171 | .Fn OBJ_create , |
157 | or | 172 | or |
158 | .Fn OBJ_create_objects . | 173 | .Fn OBJ_create_objects . |
174 | Otherwise, | ||
175 | .Fn OBJ_cleanup | ||
176 | only sets | ||
177 | .Va obj_cleanup_defer | ||
178 | to 2, which defers the cleanup of the internal object table | ||
179 | to the next call of | ||
180 | .Xr EVP_cleanup 3 . | ||
181 | .Pp | ||
182 | By default, | ||
183 | .Xr EVP_cleanup 3 | ||
184 | has no effect on the internal object table. | ||
185 | Only if | ||
186 | .Va obj_cleanup_defer | ||
187 | is 2, it resets | ||
188 | .Va obj_cleanup_defer | ||
189 | to 0 and calls | ||
190 | .Fn OBJ_cleanup , | ||
191 | which then resets the table to its default state. | ||
192 | .Pp | ||
193 | The function | ||
194 | .Fn check_defer | ||
195 | sets | ||
196 | .Va obj_cleanup_defer | ||
197 | to 1 unless | ||
198 | .Fa nid | ||
199 | is a built-in numeric identifier, but it has no effect if | ||
200 | .Va obj_cleanup_defer | ||
201 | already differs from 0. | ||
202 | This function is called internally by various functions | ||
203 | in the EVP library, in particular by subroutines of | ||
204 | .Xr OpenSSL_add_all_ciphers 3 | ||
205 | and | ||
206 | .Xr OpenSSL_add_all_digests 3 . | ||
207 | .Pp | ||
208 | To reliably reset the internal object table no matter what the | ||
209 | current state may be, an application program needs to call both | ||
210 | .Fn OBJ_cleanup | ||
211 | and | ||
212 | .Xr EVP_cleanup 3 , | ||
213 | in this order. | ||
214 | The opposite order will usually not work. | ||
159 | .Sh RETURN VALUES | 215 | .Sh RETURN VALUES |
160 | .Fn OBJ_new_nid | 216 | .Fn OBJ_new_nid |
161 | returns the new NID. | 217 | returns the new NID. |
@@ -196,6 +252,7 @@ obj = OBJ_nid2obj(new_nid); | |||
196 | .Ed | 252 | .Ed |
197 | .Sh SEE ALSO | 253 | .Sh SEE ALSO |
198 | .Xr ASN1_OBJECT_new 3 , | 254 | .Xr ASN1_OBJECT_new 3 , |
255 | .Xr EVP_cleanup 3 , | ||
199 | .Xr OBJ_nid2obj 3 | 256 | .Xr OBJ_nid2obj 3 |
200 | .Sh HISTORY | 257 | .Sh HISTORY |
201 | .Fn OBJ_new_nid , | 258 | .Fn OBJ_new_nid , |
@@ -207,6 +264,12 @@ first appeared in SSLeay 0.8.0 and | |||
207 | in SSLeay 0.9.0. | 264 | in SSLeay 0.9.0. |
208 | These functions have been available since | 265 | These functions have been available since |
209 | .Ox 2.4 . | 266 | .Ox 2.4 . |
267 | .Pp | ||
268 | .Va obj_cleanup_defer | ||
269 | and | ||
270 | .Fn check_defer | ||
271 | first appeared in OpenSSL 1.0.0 and have been available since | ||
272 | .Ox 4.9 . | ||
210 | .Sh BUGS | 273 | .Sh BUGS |
211 | .Fn OBJ_new_nid | 274 | .Fn OBJ_new_nid |
212 | does not reserve any return value to indicate an error. | 275 | does not reserve any return value to indicate an error. |
diff --git a/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 b/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 index 9ef19e7163..e47948df4c 100644 --- a/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 +++ b/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.8 2019/06/14 13:41:31 schwarze Exp $ | 1 | .\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.9 2021/12/16 16:36:16 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 | 2 | .\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: June 14 2019 $ | 51 | .Dd $Mdocdate: December 16 2021 $ |
52 | .Dt OPENSSL_ADD_ALL_ALGORITHMS 3 | 52 | .Dt OPENSSL_ADD_ALL_ALGORITHMS 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -103,6 +103,7 @@ removes all ciphers and digests from the table. | |||
103 | .Xr evp 3 , | 103 | .Xr evp 3 , |
104 | .Xr EVP_DigestInit 3 , | 104 | .Xr EVP_DigestInit 3 , |
105 | .Xr EVP_EncryptInit 3 , | 105 | .Xr EVP_EncryptInit 3 , |
106 | .Xr OBJ_cleanup 3 , | ||
106 | .Xr OPENSSL_config 3 | 107 | .Xr OPENSSL_config 3 |
107 | .Sh HISTORY | 108 | .Sh HISTORY |
108 | .Fn EVP_cleanup | 109 | .Fn EVP_cleanup |