diff options
author | schwarze <> | 2021-07-22 19:09:26 +0000 |
---|---|---|
committer | schwarze <> | 2021-07-22 19:09:26 +0000 |
commit | 774f404e615976d63468b743850d37abdb9e0340 (patch) | |
tree | 6e18ca92999099df4294483e5f3685111f269ef4 /src/lib | |
parent | 8a2b2d46e4614778f81e571b6d148f20ded9db18 (diff) | |
download | openbsd-774f404e615976d63468b743850d37abdb9e0340.tar.gz openbsd-774f404e615976d63468b743850d37abdb9e0340.tar.bz2 openbsd-774f404e615976d63468b743850d37abdb9e0340.zip |
Major cleanup.
1. Fix the order of functions to match the order they occur in
application code, making the text significantly easier to follow.
2. Do not use the same argument placeholder *sk for several different
things; call the arguments *trusted, *untrusted, and *crls as
appropriate.
3. Avoid using the word "initialised" for two different concepts
in the same manual page; it was sometimes intended to mean "fill
with zeros" and sometimes "replace the zeros with useful data".
4. Generally, make the text more precise, more straightforward,
and shorter (-84 +65 lines of mdoc code).
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/X509_STORE_CTX_new.3 | 151 |
1 files changed, 66 insertions, 85 deletions
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 index d29bcf10fc..1bc90b5ac4 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: X509_STORE_CTX_new.3,v 1.22 2021/07/22 17:11:14 schwarze Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_new.3,v 1.23 2021/07/22 19:09:26 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 | 2 | .\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 |
3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
4 | .\" | 4 | .\" |
@@ -72,9 +72,9 @@ | |||
72 | .Os | 72 | .Os |
73 | .Sh NAME | 73 | .Sh NAME |
74 | .Nm X509_STORE_CTX_new , | 74 | .Nm X509_STORE_CTX_new , |
75 | .Nm X509_STORE_CTX_init , | ||
75 | .Nm X509_STORE_CTX_cleanup , | 76 | .Nm X509_STORE_CTX_cleanup , |
76 | .Nm X509_STORE_CTX_free , | 77 | .Nm X509_STORE_CTX_free , |
77 | .Nm X509_STORE_CTX_init , | ||
78 | .Nm X509_STORE_CTX_get0_store , | 78 | .Nm X509_STORE_CTX_get0_store , |
79 | .Nm X509_STORE_CTX_set0_trusted_stack , | 79 | .Nm X509_STORE_CTX_set0_trusted_stack , |
80 | .Nm X509_STORE_CTX_trusted_stack , | 80 | .Nm X509_STORE_CTX_trusted_stack , |
@@ -90,6 +90,13 @@ | |||
90 | .In openssl/x509_vfy.h | 90 | .In openssl/x509_vfy.h |
91 | .Ft X509_STORE_CTX * | 91 | .Ft X509_STORE_CTX * |
92 | .Fn X509_STORE_CTX_new void | 92 | .Fn X509_STORE_CTX_new void |
93 | .Ft int | ||
94 | .Fo X509_STORE_CTX_init | ||
95 | .Fa "X509_STORE_CTX *ctx" | ||
96 | .Fa "X509_STORE *store" | ||
97 | .Fa "X509 *x" | ||
98 | .Fa "STACK_OF(X509) *untrusted" | ||
99 | .Fc | ||
93 | .Ft void | 100 | .Ft void |
94 | .Fo X509_STORE_CTX_cleanup | 101 | .Fo X509_STORE_CTX_cleanup |
95 | .Fa "X509_STORE_CTX *ctx" | 102 | .Fa "X509_STORE_CTX *ctx" |
@@ -98,13 +105,6 @@ | |||
98 | .Fo X509_STORE_CTX_free | 105 | .Fo X509_STORE_CTX_free |
99 | .Fa "X509_STORE_CTX *ctx" | 106 | .Fa "X509_STORE_CTX *ctx" |
100 | .Fc | 107 | .Fc |
101 | .Ft int | ||
102 | .Fo X509_STORE_CTX_init | ||
103 | .Fa "X509_STORE_CTX *ctx" | ||
104 | .Fa "X509_STORE *store" | ||
105 | .Fa "X509 *x509" | ||
106 | .Fa "STACK_OF(X509) *chain" | ||
107 | .Fc | ||
108 | .Ft X509_STORE * | 108 | .Ft X509_STORE * |
109 | .Fo X509_STORE_CTX_get0_store | 109 | .Fo X509_STORE_CTX_get0_store |
110 | .Fa "X509_STORE_CTX *ctx" | 110 | .Fa "X509_STORE_CTX *ctx" |
@@ -112,12 +112,12 @@ | |||
112 | .Ft void | 112 | .Ft void |
113 | .Fo X509_STORE_CTX_set0_trusted_stack | 113 | .Fo X509_STORE_CTX_set0_trusted_stack |
114 | .Fa "X509_STORE_CTX *ctx" | 114 | .Fa "X509_STORE_CTX *ctx" |
115 | .Fa "STACK_OF(X509) *sk" | 115 | .Fa "STACK_OF(X509) *trusted" |
116 | .Fc | 116 | .Fc |
117 | .Ft void | 117 | .Ft void |
118 | .Fo X509_STORE_CTX_trusted_stack | 118 | .Fo X509_STORE_CTX_trusted_stack |
119 | .Fa "X509_STORE_CTX *ctx" | 119 | .Fa "X509_STORE_CTX *ctx" |
120 | .Fa "STACK_OF(X509) *sk" | 120 | .Fa "STACK_OF(X509) *trusted" |
121 | .Fc | 121 | .Fc |
122 | .Ft void | 122 | .Ft void |
123 | .Fo X509_STORE_CTX_set_cert | 123 | .Fo X509_STORE_CTX_set_cert |
@@ -131,12 +131,12 @@ | |||
131 | .Ft void | 131 | .Ft void |
132 | .Fo X509_STORE_CTX_set_chain | 132 | .Fo X509_STORE_CTX_set_chain |
133 | .Fa "X509_STORE_CTX *ctx" | 133 | .Fa "X509_STORE_CTX *ctx" |
134 | .Fa "STACK_OF(X509) *sk" | 134 | .Fa "STACK_OF(X509) *untrusted" |
135 | .Fc | 135 | .Fc |
136 | .Ft void | 136 | .Ft void |
137 | .Fo X509_STORE_CTX_set0_untrusted | 137 | .Fo X509_STORE_CTX_set0_untrusted |
138 | .Fa "X509_STORE_CTX *ctx" | 138 | .Fa "X509_STORE_CTX *ctx" |
139 | .Fa "STACK_OF(X509) *sk" | 139 | .Fa "STACK_OF(X509) *untrusted" |
140 | .Fc | 140 | .Fc |
141 | .Ft STACK_OF(X509) * | 141 | .Ft STACK_OF(X509) * |
142 | .Fo X509_STORE_CTX_get0_untrusted | 142 | .Fo X509_STORE_CTX_get0_untrusted |
@@ -145,75 +145,62 @@ | |||
145 | .Ft void | 145 | .Ft void |
146 | .Fo X509_STORE_CTX_set0_crls | 146 | .Fo X509_STORE_CTX_set0_crls |
147 | .Fa "X509_STORE_CTX *ctx" | 147 | .Fa "X509_STORE_CTX *ctx" |
148 | .Fa "STACK_OF(X509_CRL) *sk" | 148 | .Fa "STACK_OF(X509_CRL) *crls" |
149 | .Fc | 149 | .Fc |
150 | .Sh DESCRIPTION | 150 | .Sh DESCRIPTION |
151 | These functions initialise an | 151 | These functions set up an |
152 | .Vt X509_STORE_CTX | 152 | .Vt X509_STORE_CTX |
153 | structure for subsequent use by | 153 | object for subsequent use by |
154 | .Xr X509_verify_cert 3 . | 154 | .Xr X509_verify_cert 3 . |
155 | .Pp | 155 | .Pp |
156 | .Fn X509_STORE_CTX_new | 156 | .Fn X509_STORE_CTX_new |
157 | returns a newly initialised | 157 | allocates an empty |
158 | .Vt X509_STORE_CTX | 158 | .Vt X509_STORE_CTX |
159 | structure. | 159 | object not yet containing the subobjects required for normal operation. |
160 | .Pp | ||
161 | .Fn X509_STORE_CTX_cleanup | ||
162 | internally cleans up an | ||
163 | .Vt X509_STORE_CTX | ||
164 | structure. | ||
165 | The context can then be reused with a new call to | ||
166 | .Fn X509_STORE_CTX_init . | ||
167 | Calling both of these functions is required before | ||
168 | .Xr X509_verify_cert 3 | ||
169 | can be called on the same | ||
170 | .Fa ctx | ||
171 | another time. | ||
172 | .Pp | ||
173 | .Fn X509_STORE_CTX_free | ||
174 | completely frees up | ||
175 | .Fa ctx . | ||
176 | After this call | ||
177 | .Fa ctx | ||
178 | is no longer valid. | ||
179 | If | ||
180 | .Fa ctx | ||
181 | is a | ||
182 | .Dv NULL | ||
183 | pointer, no action occurs. | ||
184 | .Pp | 160 | .Pp |
185 | .Fn X509_STORE_CTX_init | 161 | .Fn X509_STORE_CTX_init |
186 | sets up | 162 | needs to be called on each new |
187 | .Fa ctx | 163 | .Fa ctx |
188 | for one single subsequent verification operation using | 164 | before any of the other functions become useful. |
165 | It prepares | ||
166 | .Fa ctx | ||
167 | for one single verification operation using | ||
189 | .Xr X509_verify_cert 3 . | 168 | .Xr X509_verify_cert 3 . |
190 | The trusted certificate store is set to | 169 | The trusted certificate |
191 | .Fa store , | 170 | .Fa store |
192 | the end entity certificate to be verified is set to | 171 | to be used, the end entity certificate |
193 | .Fa x509 , | 172 | .Fa x |
194 | and a set of additional certificates (which will be untrusted but may be | 173 | to be verified, and a set of additional |
195 | used to build the chain) can be supplied in | 174 | .Fa untrusted |
196 | .Fa chain . | 175 | certificates, to be used for building the chain, |
197 | Any or all of the | 176 | can be supplied, or any or all of them can be set to |
198 | .Fa store , | ||
199 | .Fa x509 , | ||
200 | and | ||
201 | .Fa chain | ||
202 | parameters can be | ||
203 | .Dv NULL . | 177 | .Dv NULL . |
204 | The three pointers passed in are stored internally, the three objects | 178 | The three pointers passed in are stored internally, the three objects |
205 | pointed to are not copied, their reference count is not incremented, | 179 | pointed to are not copied, their reference count is not incremented, |
206 | and the caller remains responsible for managing their storage and for | 180 | and the caller remains responsible for managing their storage and for |
207 | not freeing them until either | 181 | not freeing them before |
208 | .Fn X509_STORE_CTX_free | 182 | .Fn X509_STORE_CTX_free |
209 | is called on | 183 | is called on |
210 | .Fa ctx | 184 | .Fa ctx . |
211 | or until both | 185 | .Pp |
212 | .Fn X509_STORE_CTX_cleanup | 186 | .Fn X509_STORE_CTX_cleanup |
213 | and | 187 | internally cleans up |
214 | .Fn X509_STORE_CTX_init | 188 | .Fa ctx , |
215 | are called on | 189 | returning it to an empty state similar to the one after |
190 | .Fn X509_STORE_CTX_new . | ||
191 | It can then be reused with a new call to | ||
192 | .Fn X509_STORE_CTX_init . | ||
193 | .Pp | ||
194 | .Fn X509_STORE_CTX_free | ||
195 | calls | ||
196 | .Fn X509_STORE_CTX_cleanup | ||
197 | and frees the storage pointed to by | ||
216 | .Fa ctx . | 198 | .Fa ctx . |
199 | If | ||
200 | .Fa ctx | ||
201 | is a | ||
202 | .Dv NULL | ||
203 | pointer, no action occurs. | ||
217 | .Pp | 204 | .Pp |
218 | .Fn X509_STORE_CTX_get0_store | 205 | .Fn X509_STORE_CTX_get0_store |
219 | returns the internal pointer to the trusted certificate | 206 | returns the internal pointer to the trusted certificate |
@@ -222,13 +209,13 @@ that was set with | |||
222 | .Fn X509_STORE_CTX_init . | 209 | .Fn X509_STORE_CTX_init . |
223 | .Pp | 210 | .Pp |
224 | .Fn X509_STORE_CTX_set0_trusted_stack | 211 | .Fn X509_STORE_CTX_set0_trusted_stack |
225 | sets the set of trusted certificates of | 212 | sets the set of |
226 | .Fa ctx | 213 | .Fa trusted |
227 | to | 214 | certificates used by |
228 | .Fa sk . | 215 | .Fa ctx . |
229 | This is an alternative way of specifying trusted certificates instead of | 216 | This is an alternative way of specifying trusted certificates instead of |
230 | using an | 217 | using the |
231 | .Vt X509_STORE . | 218 | .Fa store . |
232 | .Fn X509_STORE_CTX_trusted_stack | 219 | .Fn X509_STORE_CTX_trusted_stack |
233 | is a deprecated alias for | 220 | is a deprecated alias for |
234 | .Fn X509_STORE_CTX_set0_trusted_stack . | 221 | .Fn X509_STORE_CTX_set0_trusted_stack . |
@@ -254,10 +241,10 @@ or | |||
254 | .Fn X509_STORE_CTX_set_chain | 241 | .Fn X509_STORE_CTX_set_chain |
255 | and | 242 | and |
256 | .Fn X509_STORE_CTX_set0_untrusted | 243 | .Fn X509_STORE_CTX_set0_untrusted |
257 | are identical and set the additional, untrusted certificates used by | 244 | are identical and set the additional, |
258 | .Fa ctx | 245 | .Fa untrusted |
259 | to | 246 | certificates used by |
260 | .Fa sk , | 247 | .Fa ctx , |
261 | overriding the set of additional, untrusted certificates that was set with | 248 | overriding the set of additional, untrusted certificates that was set with |
262 | .Fn X509_STORE_CTX_init . | 249 | .Fn X509_STORE_CTX_init . |
263 | Again, the set and the certificates contained in it are not copied | 250 | Again, the set and the certificates contained in it are not copied |
@@ -274,8 +261,9 @@ or | |||
274 | .Fn X509_STORE_CTX_set0_untrusted . | 261 | .Fn X509_STORE_CTX_set0_untrusted . |
275 | .Pp | 262 | .Pp |
276 | .Fn X509_STORE_CTX_set0_crls | 263 | .Fn X509_STORE_CTX_set0_crls |
277 | sets a set of CRLs to use to aid certificate verification to | 264 | sets a set of |
278 | .Fa sk . | 265 | .Fa crls |
266 | to use during certificate verification. | ||
279 | These CRLs will only be used if CRL verification is enabled in the | 267 | These CRLs will only be used if CRL verification is enabled in the |
280 | associated | 268 | associated |
281 | .Vt X509_VERIFY_PARAM | 269 | .Vt X509_VERIFY_PARAM |
@@ -283,11 +271,6 @@ structure. | |||
283 | This might be used where additional "useful" CRLs are supplied as part | 271 | This might be used where additional "useful" CRLs are supplied as part |
284 | of a protocol, for example in a PKCS#7 structure. | 272 | of a protocol, for example in a PKCS#7 structure. |
285 | .Pp | 273 | .Pp |
286 | The certificates and CRLs in a store are used internally and should | ||
287 | .Sy not | ||
288 | be freed up until after the associated | ||
289 | .Vt X509_STORE_CTX | ||
290 | is freed. | ||
291 | Legacy applications might implicitly use an | 274 | Legacy applications might implicitly use an |
292 | .Vt X509_STORE_CTX | 275 | .Vt X509_STORE_CTX |
293 | like this: | 276 | like this: |
@@ -317,11 +300,9 @@ if an error occurred. | |||
317 | returns 1 for success or 0 if an error occurred. | 300 | returns 1 for success or 0 if an error occurred. |
318 | .Pp | 301 | .Pp |
319 | .Fn X509_STORE_CTX_get0_store | 302 | .Fn X509_STORE_CTX_get0_store |
320 | returns a pointer to the trusted certificate store or | 303 | returns the internal pointer to the trusted certificate store or |
321 | .Dv NULL | 304 | .Dv NULL |
322 | if | 305 | if none was set. |
323 | .Fa ctx | ||
324 | was not initialised. | ||
325 | .Pp | 306 | .Pp |
326 | .Fn X509_STORE_CTX_get0_cert | 307 | .Fn X509_STORE_CTX_get0_cert |
327 | returns the internal pointer to the certificate to be verified or | 308 | returns the internal pointer to the certificate to be verified or |
@@ -343,8 +324,8 @@ if no set of additional certificates was provided. | |||
343 | .Xr X509_verify_cert 3 , | 324 | .Xr X509_verify_cert 3 , |
344 | .Xr X509_VERIFY_PARAM_set_flags 3 | 325 | .Xr X509_VERIFY_PARAM_set_flags 3 |
345 | .Sh HISTORY | 326 | .Sh HISTORY |
346 | .Fn X509_STORE_CTX_cleanup , | ||
347 | .Fn X509_STORE_CTX_init , | 327 | .Fn X509_STORE_CTX_init , |
328 | .Fn X509_STORE_CTX_cleanup , | ||
348 | .Fn X509_STORE_CTX_set_cert , | 329 | .Fn X509_STORE_CTX_set_cert , |
349 | and | 330 | and |
350 | .Fn X509_STORE_CTX_set_chain | 331 | .Fn X509_STORE_CTX_set_chain |