summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-12-16 18:02:28 +0000
committertb <>2022-12-16 18:02:28 +0000
commit68cfe389d0ebb0d9cc9db2fd372db328d5499e1c (patch)
treebe7accd18799416ed9e1926d2191a1151d7cad78 /src
parente3c1dbeb9eb2028277ed68307ae16673ebabae9b (diff)
downloadopenbsd-68cfe389d0ebb0d9cc9db2fd372db328d5499e1c.tar.gz
openbsd-68cfe389d0ebb0d9cc9db2fd372db328d5499e1c.tar.bz2
openbsd-68cfe389d0ebb0d9cc9db2fd372db328d5499e1c.zip
Document extension caching of X509_check_purpose()
The overwhelming majority of callers of X509_check_purpose() in our tree pass a purpose of -1. In this case X509_check_purpose() acts as a wrapper of x509v3_cache_extensions() which makes sanity checks like non-negativity of ASN.1 integers or canonicity of RFC 3779 extensions as well as checking uniqueness of extensions. from schwarze who beat an initial diff of mine into shape
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/X509_check_purpose.366
1 files changed, 43 insertions, 23 deletions
diff --git a/src/lib/libcrypto/man/X509_check_purpose.3 b/src/lib/libcrypto/man/X509_check_purpose.3
index e0737251eb..ff5ab592b0 100644
--- a/src/lib/libcrypto/man/X509_check_purpose.3
+++ b/src/lib/libcrypto/man/X509_check_purpose.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_check_purpose.3,v 1.7 2021/10/29 14:29:24 schwarze Exp $ 1.\" $OpenBSD: X509_check_purpose.3,v 1.8 2022/12/16 18:02:28 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2019, 2021 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: October 29 2021 $ 17.Dd $Mdocdate: December 16 2022 $
18.Dt X509_CHECK_PURPOSE 3 18.Dt X509_CHECK_PURPOSE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -30,10 +30,26 @@
30.Fc 30.Fc
31.Sh DESCRIPTION 31.Sh DESCRIPTION
32If the 32If the
33.Fa purpose
34argument is \-1,
35.Fn X509_check_purpose
36ignores the
37.Fa ca
38argument and checks that all the extensions of the
39.Fa certificate
40can be parsed and pass minimal sanity checks, in particular that
41extensions that must not occur more than once do not.
42It also makes sure that all extensions are cached in the
43.Vt X509
44object.
45.Pp
46If the
47.Fa purpose
48argument is not \-1 and the
33.Fa ca 49.Fa ca
34flag is 0, 50flag is 0,
35.Fn X509_check_purpose 51.Fn X509_check_purpose
36checks whether the public key contained in the 52additionally checks whether the public key contained in the
37.Fa certificate 53.Fa certificate
38is intended to be used for the given 54is intended to be used for the given
39.Fa purpose , 55.Fa purpose ,
@@ -205,10 +221,12 @@ bits is set, and no other bits are set.
205.El 221.El
206.Pp 222.Pp
207If the 223If the
224.Fa purpose
225argument is not \-1 and the
208.Fa ca 226.Fa ca
209flag is non-zero, 227flag is non-zero,
210.Fn X509_check_purpose 228.Fn X509_check_purpose
211instead checks whether the 229instead checks, in addition to the minimal sanity checks, whether the
212.Fa certificate 230.Fa certificate
213can be used as a certificate authority certificate 231can be used as a certificate authority certificate
214in the context of the given 232in the context of the given
@@ -334,14 +352,6 @@ The check even succeeds if the three other common conditions
334cited above this list are violated. 352cited above this list are violated.
335.El 353.El
336.Pp 354.Pp
337If parsing of any extensions that are present succeeds and the
338.Fa purpose
339argument is \-1,
340.Fn X509_check_purpose
341always succeeds, no matter whether or not the
342.Fa ca
343flag is set.
344.Pp
345If the function 355If the function
346.Xr X509_PURPOSE_add 3 356.Xr X509_PURPOSE_add 3
347was called before 357was called before
@@ -352,22 +362,28 @@ installed additional, user-supplied checking functions for user-defined
352.Fa purpose 362.Fa purpose
353identifiers not listed above. 363identifiers not listed above.
354.Sh RETURN VALUES 364.Sh RETURN VALUES
365If parsing of certificate extensions or sanity checks fail or the
366.Fa purpose
367is invalid,
355.Fn X509_check_purpose 368.Fn X509_check_purpose
356returns the following values: 369returns \-1 to indicate the error.
357.Bl -column -1 Failure -compact 370.Pp
358.It \-1 Ta Error Ta Parsing of certificate extensions failed or the 371If the
359.Fa purpose 372.Fa purpose
360is invalid. 373argument is \-1 and parsing and minimal sanity checks succeed,
361.It 0 Ta Failure Ta The 374.Fn X509_check_purpose
362.Fa certificate 375returns 1 to indicate success.
363cannot be used for the 376.Pp
364.Fa purpose . 377Otherwise, it returns the following values:
365.El
366.Pp 378.Pp
367If 379If
368.Fa ca 380.Fa ca
369is 0, the following values can also be returned: 381is 0:
370.Bl -column -1 Failure -compact 382.Bl -column -1 Failure -compact
383.It 0 Ta Failure Ta The
384.Fa certificate
385cannot be used for the
386.Fa purpose .
371.It 1 Ta Success Ta The 387.It 1 Ta Success Ta The
372.Fa certificate 388.Fa certificate
373can be used for the 389can be used for the
@@ -377,8 +393,12 @@ can be used for the
377.Pp 393.Pp
378If 394If
379.Fa ca 395.Fa ca
380is non-zero, the following values can also be returned: 396is non-zero:
381.Bl -column -1 Failure -compact 397.Bl -column -1 Failure -compact
398.It 0 Ta Failure Ta The
399.Fa certificate
400cannot be used as a CA for the
401.Fa purpose .
382.It 1 Ta Success Ta The 402.It 1 Ta Success Ta The
383.Fa certificate 403.Fa certificate
384can be used as a CA for the 404can be used as a CA for the