summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2021-07-22 19:09:26 +0000
committerschwarze <>2021-07-22 19:09:26 +0000
commit774f404e615976d63468b743850d37abdb9e0340 (patch)
tree6e18ca92999099df4294483e5f3685111f269ef4 /src/lib
parent8a2b2d46e4614778f81e571b6d148f20ded9db18 (diff)
downloadopenbsd-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.3151
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
151These functions initialise an 151These functions set up an
152.Vt X509_STORE_CTX 152.Vt X509_STORE_CTX
153structure for subsequent use by 153object 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
157returns a newly initialised 157allocates an empty
158.Vt X509_STORE_CTX 158.Vt X509_STORE_CTX
159structure. 159object not yet containing the subobjects required for normal operation.
160.Pp
161.Fn X509_STORE_CTX_cleanup
162internally cleans up an
163.Vt X509_STORE_CTX
164structure.
165The context can then be reused with a new call to
166.Fn X509_STORE_CTX_init .
167Calling both of these functions is required before
168.Xr X509_verify_cert 3
169can be called on the same
170.Fa ctx
171another time.
172.Pp
173.Fn X509_STORE_CTX_free
174completely frees up
175.Fa ctx .
176After this call
177.Fa ctx
178is no longer valid.
179If
180.Fa ctx
181is a
182.Dv NULL
183pointer, no action occurs.
184.Pp 160.Pp
185.Fn X509_STORE_CTX_init 161.Fn X509_STORE_CTX_init
186sets up 162needs to be called on each new
187.Fa ctx 163.Fa ctx
188for one single subsequent verification operation using 164before any of the other functions become useful.
165It prepares
166.Fa ctx
167for one single verification operation using
189.Xr X509_verify_cert 3 . 168.Xr X509_verify_cert 3 .
190The trusted certificate store is set to 169The trusted certificate
191.Fa store , 170.Fa store
192the end entity certificate to be verified is set to 171to be used, the end entity certificate
193.Fa x509 , 172.Fa x
194and a set of additional certificates (which will be untrusted but may be 173to be verified, and a set of additional
195used to build the chain) can be supplied in 174.Fa untrusted
196.Fa chain . 175certificates, to be used for building the chain,
197Any or all of the 176can be supplied, or any or all of them can be set to
198.Fa store ,
199.Fa x509 ,
200and
201.Fa chain
202parameters can be
203.Dv NULL . 177.Dv NULL .
204The three pointers passed in are stored internally, the three objects 178The three pointers passed in are stored internally, the three objects
205pointed to are not copied, their reference count is not incremented, 179pointed to are not copied, their reference count is not incremented,
206and the caller remains responsible for managing their storage and for 180and the caller remains responsible for managing their storage and for
207not freeing them until either 181not freeing them before
208.Fn X509_STORE_CTX_free 182.Fn X509_STORE_CTX_free
209is called on 183is called on
210.Fa ctx 184.Fa ctx .
211or until both 185.Pp
212.Fn X509_STORE_CTX_cleanup 186.Fn X509_STORE_CTX_cleanup
213and 187internally cleans up
214.Fn X509_STORE_CTX_init 188.Fa ctx ,
215are called on 189returning it to an empty state similar to the one after
190.Fn X509_STORE_CTX_new .
191It can then be reused with a new call to
192.Fn X509_STORE_CTX_init .
193.Pp
194.Fn X509_STORE_CTX_free
195calls
196.Fn X509_STORE_CTX_cleanup
197and frees the storage pointed to by
216.Fa ctx . 198.Fa ctx .
199If
200.Fa ctx
201is a
202.Dv NULL
203pointer, no action occurs.
217.Pp 204.Pp
218.Fn X509_STORE_CTX_get0_store 205.Fn X509_STORE_CTX_get0_store
219returns the internal pointer to the trusted certificate 206returns 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
225sets the set of trusted certificates of 212sets the set of
226.Fa ctx 213.Fa trusted
227to 214certificates used by
228.Fa sk . 215.Fa ctx .
229This is an alternative way of specifying trusted certificates instead of 216This is an alternative way of specifying trusted certificates instead of
230using an 217using the
231.Vt X509_STORE . 218.Fa store .
232.Fn X509_STORE_CTX_trusted_stack 219.Fn X509_STORE_CTX_trusted_stack
233is a deprecated alias for 220is 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
255and 242and
256.Fn X509_STORE_CTX_set0_untrusted 243.Fn X509_STORE_CTX_set0_untrusted
257are identical and set the additional, untrusted certificates used by 244are identical and set the additional,
258.Fa ctx 245.Fa untrusted
259to 246certificates used by
260.Fa sk , 247.Fa ctx ,
261overriding the set of additional, untrusted certificates that was set with 248overriding the set of additional, untrusted certificates that was set with
262.Fn X509_STORE_CTX_init . 249.Fn X509_STORE_CTX_init .
263Again, the set and the certificates contained in it are not copied 250Again, 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
277sets a set of CRLs to use to aid certificate verification to 264sets a set of
278.Fa sk . 265.Fa crls
266to use during certificate verification.
279These CRLs will only be used if CRL verification is enabled in the 267These CRLs will only be used if CRL verification is enabled in the
280associated 268associated
281.Vt X509_VERIFY_PARAM 269.Vt X509_VERIFY_PARAM
@@ -283,11 +271,6 @@ structure.
283This might be used where additional "useful" CRLs are supplied as part 271This might be used where additional "useful" CRLs are supplied as part
284of a protocol, for example in a PKCS#7 structure. 272of a protocol, for example in a PKCS#7 structure.
285.Pp 273.Pp
286The certificates and CRLs in a store are used internally and should
287.Sy not
288be freed up until after the associated
289.Vt X509_STORE_CTX
290is freed.
291Legacy applications might implicitly use an 274Legacy applications might implicitly use an
292.Vt X509_STORE_CTX 275.Vt X509_STORE_CTX
293like this: 276like this:
@@ -317,11 +300,9 @@ if an error occurred.
317returns 1 for success or 0 if an error occurred. 300returns 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
320returns a pointer to the trusted certificate store or 303returns the internal pointer to the trusted certificate store or
321.Dv NULL 304.Dv NULL
322if 305if none was set.
323.Fa ctx
324was not initialised.
325.Pp 306.Pp
326.Fn X509_STORE_CTX_get0_cert 307.Fn X509_STORE_CTX_get0_cert
327returns the internal pointer to the certificate to be verified or 308returns 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 ,
349and 330and
350.Fn X509_STORE_CTX_set_chain 331.Fn X509_STORE_CTX_set_chain