summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2021-10-30 16:20:35 +0000
committerschwarze <>2021-10-30 16:20:35 +0000
commit1507ec383c4225e409a40fc53eb43aec39bd4b66 (patch)
tree659176c3c20d98443281077c6c089ca93c678b31
parentebf7bdd740439b0c094f1a97f94bd885a052642b (diff)
downloadopenbsd-1507ec383c4225e409a40fc53eb43aec39bd4b66.tar.gz
openbsd-1507ec383c4225e409a40fc53eb43aec39bd4b66.tar.bz2
openbsd-1507ec383c4225e409a40fc53eb43aec39bd4b66.zip
new manual page X509_CRL_METHOD_new(3)
documenting five functions to customize CRL handling
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/X509_CRL_METHOD_new.3182
-rw-r--r--src/lib/libcrypto/man/X509_CRL_get0_by_serial.319
-rw-r--r--src/lib/libcrypto/man/X509_CRL_new.320
-rw-r--r--src/lib/libcrypto/man/X509_sign.317
-rw-r--r--src/lib/libcrypto/man/d2i_X509_CRL.318
6 files changed, 245 insertions, 14 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 43d7c5bc56..1e2c626d0c 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.207 2021/10/29 09:42:07 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.208 2021/10/30 16:20:35 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -286,6 +286,7 @@ MAN= \
286 X509_ATTRIBUTE_new.3 \ 286 X509_ATTRIBUTE_new.3 \
287 X509_ATTRIBUTE_set1_object.3 \ 287 X509_ATTRIBUTE_set1_object.3 \
288 X509_CINF_new.3 \ 288 X509_CINF_new.3 \
289 X509_CRL_METHOD_new.3 \
289 X509_CRL_get0_by_serial.3 \ 290 X509_CRL_get0_by_serial.3 \
290 X509_CRL_new.3 \ 291 X509_CRL_new.3 \
291 X509_CRL_print.3 \ 292 X509_CRL_print.3 \
diff --git a/src/lib/libcrypto/man/X509_CRL_METHOD_new.3 b/src/lib/libcrypto/man/X509_CRL_METHOD_new.3
new file mode 100644
index 0000000000..f80ce743cd
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_CRL_METHOD_new.3
@@ -0,0 +1,182 @@
1.\" $OpenBSD: X509_CRL_METHOD_new.3,v 1.1 2021/10/30 16:20:35 schwarze Exp $
2.\"
3.\" Copyright (c) 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: October 30 2021 $
18.Dt X509_CRL_METHOD_NEW 3
19.Os
20.Sh NAME
21.Nm X509_CRL_METHOD_new ,
22.Nm X509_CRL_METHOD_free ,
23.Nm X509_CRL_set_default_method ,
24.Nm X509_CRL_set_meth_data ,
25.Nm X509_CRL_get_meth_data
26.Nd customize CRL handling
27.Sh SYNOPSIS
28.In openssl/x509.h
29.Ft X509_CRL_METHOD *
30.Fo X509_CRL_METHOD_new
31.Fa "int (*crl_init)(X509_CRL *crl)"
32.Fa "int (*crl_free)(X509_CRL *crl)"
33.Fa "int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,\
34 ASN1_INTEGER *ser, X509_NAME *issuer)"
35.Fa "int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)"
36.Fc
37.Ft void
38.Fn X509_CRL_METHOD_free "X509_CRL_METHOD *method"
39.Ft void
40.Fn X509_CRL_set_default_method "const X509_CRL_METHOD *method"
41.Ft void
42.Fn X509_CRL_set_meth_data "X509_CRL *crl" "void *data"
43.Ft void *
44.Fn X509_CRL_get_meth_data "X509_CRL *crl"
45.Sh DESCRIPTION
46These functions customize BER decoding and signature verification
47of X.509 certificate revocation lists,
48as well as retrieval of revoked entries from such lists.
49.Pp
50.Fn X509_CRL_METHOD_new
51allocates and initializes a new
52.Vt X509_CRL_METHOD
53object, storing the four pointers to callback functions in it
54that are provided as arguments.
55.Pp
56.Fn X509_CRL_METHOD_free
57frees the given
58.Fa method
59object.
60If
61.Fa method
62is a
63.Dv NULL
64pointer or points to the static object built into the library,
65no action occurs.
66.Pp
67.Fn X509_CRL_set_default_method
68designates the given
69.Fa method
70to be used for objects that will be created with
71.Xr X509_CRL_new 3
72in the future.
73It has no effect on
74.Vt X509_CRL
75objects that already exist.
76If
77.Fa method
78is
79.Dv NULL ,
80any previously installed method will no longer be used for new
81.Vt X509_CRL
82objects created in the future, and those future objects will adhere
83to the default behaviour instead.
84.Pp
85The optional function
86.Fn crl_init
87will be called at the end of
88.Xr d2i_X509_CRL 3 ,
89the optional function
90.Fn crl_free
91near the end of
92.Xr X509_CRL_free 3 ,
93immediately before freeing
94.Fa crl
95itself.
96The function
97.Fn crl_lookup
98will be called by
99.Xr X509_CRL_get0_by_serial 3 ,
100setting
101.Fa issuer
102to
103.Dv NULL ,
104and by
105.Xr X509_CRL_get0_by_cert 3 ,
106both instead of performing the default action.
107The function
108.Fn crl_verify
109will be called by
110.Xr X509_CRL_verify 3
111instead of performing the default action.
112.Pp
113.Fn X509_CRL_set_meth_data
114stores the pointer to the auxiliary
115.Fa data
116inside the
117.Fa crl
118object.
119The pointer is expected to remain valid during the whole lifetime of the
120.Fa crl
121object but is not automatically freed when the
122.Fa crl
123object is freed.
124.Pp
125.Fn X509_CRL_get_meth_data
126retrieves the
127.Fa data
128from
129.Fa crl
130the was added with
131.Fn X509_CRL_set_meth_data .
132This may for example be useful inside the four callback methods
133installed with
134.Fn X509_CRL_METHOD_new .
135.Sh RETURN VALUES
136.Fn X509_CRL_METHOD_new
137returns a pointer to the new object or
138.Dv NULL
139if memory allocation fails.
140.Pp
141.Fn X509_CRL_get_meth_data
142returns the pointer previously installed with
143.Fn X509_CRL_set_meth_data
144or
145.Dv NULL
146if
147.Fn X509_CRL_set_meth_data
148was not called on
149.Fa crl .
150.Pp
151The callback functions
152.Fn crl_init
153and
154.Fn crl_free
155are supposed to return 1 for success or 0 for failure.
156.Pp
157The callback function
158.Fn crl_lookup
159is supposed to return 0 for failure or 1 for success,
160except if the revoked entry has the reason
161.Qq removeFromCRL ,
162in which case it is supposed to return 2.
163.Pp
164The callback function
165.Fn crl_verify
166is supposed to return 1 if the signature is valid
167or 0 if the signature check fails.
168If the signature could not be checked at all because it was invalid
169or some other error occurred, \-1 may be returned.
170.Sh SEE ALSO
171.Xr ASN1_INTEGER_new 3 ,
172.Xr d2i_X509_CRL 3 ,
173.Xr EVP_PKEY_new 3 ,
174.Xr X509_CRL_get0_by_serial 3 ,
175.Xr X509_CRL_new 3 ,
176.Xr X509_CRL_verify 3 ,
177.Xr X509_NAME_new 3 ,
178.Xr X509_REVOKED_new 3
179.Sh HISTORY
180These functions first appeared in OpenSSL 1.0.0
181and have been available since
182.Ox 4.9 .
diff --git a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
index 8db046051b..865e86feb9 100644
--- a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
+++ b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
@@ -1,5 +1,5 @@
1.\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.11 2020/10/21 17:17:43 tb Exp $ 1.\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.12 2021/10/30 16:20:35 schwarze Exp $
2.\" OpenSSL X509_CRL_get0_by_serial.pod cdd6c8c5 Mar 20 12:29:37 2017 +0100 2.\" full merge up to: OpenSSL cdd6c8c5 Mar 20 12:29:37 2017 +0100
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>.
5.\" Copyright (c) 2015, 2017 The OpenSSL Project. All rights reserved. 5.\" Copyright (c) 2015, 2017 The OpenSSL Project. All rights reserved.
@@ -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: October 21 2020 $ 51.Dd $Mdocdate: October 30 2021 $
52.Dt X509_CRL_GET0_BY_SERIAL 3 52.Dt X509_CRL_GET0_BY_SERIAL 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -105,6 +105,18 @@ except that it looks for a revoked entry using the serial number
105of certificate 105of certificate
106.Fa x . 106.Fa x .
107.Pp 107.Pp
108If
109.Xr X509_CRL_set_default_method 3
110was in effect at the time the
111.Fa crl
112object was created,
113.Fn X509_CRL_get0_by_serial
114and
115.Fn X509_CRL_get0_by_cert
116invoke the
117.Fn crl_lookup
118callback function instead of performing the default action.
119.Pp
108.Fn X509_CRL_get_REVOKED 120.Fn X509_CRL_get_REVOKED
109returns an internal pointer to a stack of all revoked entries for 121returns an internal pointer to a stack of all revoked entries for
110.Fa crl . 122.Fa crl .
@@ -158,6 +170,7 @@ returns a STACK of revoked entries.
158.Xr X509_CRL_get_ext 3 , 170.Xr X509_CRL_get_ext 3 ,
159.Xr X509_CRL_get_issuer 3 , 171.Xr X509_CRL_get_issuer 3 ,
160.Xr X509_CRL_get_version 3 , 172.Xr X509_CRL_get_version 3 ,
173.Xr X509_CRL_METHOD_new 3 ,
161.Xr X509_CRL_new 3 , 174.Xr X509_CRL_new 3 ,
162.Xr X509_REVOKED_new 3 , 175.Xr X509_REVOKED_new 3 ,
163.Xr X509V3_get_d2i 3 176.Xr X509V3_get_d2i 3
diff --git a/src/lib/libcrypto/man/X509_CRL_new.3 b/src/lib/libcrypto/man/X509_CRL_new.3
index 4d3f97afdb..82ba18266a 100644
--- a/src/lib/libcrypto/man/X509_CRL_new.3
+++ b/src/lib/libcrypto/man/X509_CRL_new.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: X509_CRL_new.3,v 1.12 2021/08/02 16:21:11 schwarze Exp $ 1.\" $OpenBSD: X509_CRL_new.3,v 1.13 2021/10/30 16:20:35 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2018 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2018, 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
5.\" Permission to use, copy, modify, and distribute this software for any 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 6.\" purpose with or without fee is hereby granted, provided that the above
@@ -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 2 2021 $ 17.Dd $Mdocdate: October 30 2021 $
18.Dt X509_CRL_NEW 3 18.Dt X509_CRL_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -67,6 +67,19 @@ decrements the reference count of
67by 1. 67by 1.
68If the reference count reaches 0, it frees 68If the reference count reaches 0, it frees
69.Fa crl . 69.Fa crl .
70If
71.Xr X509_CRL_set_default_method 3
72was in effect at the time
73.Fa crl
74was created and the
75.Fn crl_free
76callback is not
77.Dv NULL ,
78that callback is invoked near the end of
79.Fn X509_CRL_free ,
80right before freeing
81.Fa crl
82itself.
70.Pp 83.Pp
71.Fn X509_CRL_INFO_new 84.Fn X509_CRL_INFO_new
72allocates and initializes an empty 85allocates and initializes an empty
@@ -112,6 +125,7 @@ returns 1 on success or 0 on error.
112.Xr X509_CRL_get_issuer 3 , 125.Xr X509_CRL_get_issuer 3 ,
113.Xr X509_CRL_get_version 3 , 126.Xr X509_CRL_get_version 3 ,
114.Xr X509_CRL_match 3 , 127.Xr X509_CRL_match 3 ,
128.Xr X509_CRL_METHOD_new 3 ,
115.Xr X509_CRL_print 3 , 129.Xr X509_CRL_print 3 ,
116.Xr X509_CRL_sign 3 , 130.Xr X509_CRL_sign 3 ,
117.Xr X509_EXTENSION_new 3 , 131.Xr X509_EXTENSION_new 3 ,
diff --git a/src/lib/libcrypto/man/X509_sign.3 b/src/lib/libcrypto/man/X509_sign.3
index ca4c5192b2..eb69874cdc 100644
--- a/src/lib/libcrypto/man/X509_sign.3
+++ b/src/lib/libcrypto/man/X509_sign.3
@@ -1,5 +1,5 @@
1.\" $OpenBSD: X509_sign.3,v 1.8 2019/06/14 13:59:32 schwarze Exp $ 1.\" $OpenBSD: X509_sign.3,v 1.9 2021/10/30 16:20:35 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
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>.
5.\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved. 5.\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved.
@@ -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: October 30 2021 $
52.Dt X509_SIGN 3 52.Dt X509_SIGN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -145,6 +145,16 @@ and
145.Fn X509_CRL_verify 145.Fn X509_CRL_verify
146sign and verify certificate requests and CRLs, respectively. 146sign and verify certificate requests and CRLs, respectively.
147.Pp 147.Pp
148If
149.Xr X509_CRL_set_default_method 3
150was in effect at the time the
151.Vt X509_CRL
152object was created,
153.Fn X509_CRL_verify
154calls the
155.Fn crl_verify
156callback function instead of performing the default action.
157.Pp
148.Fn X509_sign_ctx 158.Fn X509_sign_ctx
149is used where the default parameters for the corresponding public key 159is used where the default parameters for the corresponding public key
150and digest are not suitable. 160and digest are not suitable.
@@ -181,6 +191,7 @@ In some cases of failure, the reason can be determined with
181.Xr d2i_X509 3 , 191.Xr d2i_X509 3 ,
182.Xr EVP_DigestInit 3 , 192.Xr EVP_DigestInit 3 ,
183.Xr X509_CRL_get0_by_serial 3 , 193.Xr X509_CRL_get0_by_serial 3 ,
194.Xr X509_CRL_METHOD_new 3 ,
184.Xr X509_CRL_new 3 , 195.Xr X509_CRL_new 3 ,
185.Xr X509_get_pubkey 3 , 196.Xr X509_get_pubkey 3 ,
186.Xr X509_get_subject_name 3 , 197.Xr X509_get_subject_name 3 ,
diff --git a/src/lib/libcrypto/man/d2i_X509_CRL.3 b/src/lib/libcrypto/man/d2i_X509_CRL.3
index 920be4aa89..a0a19b4f55 100644
--- a/src/lib/libcrypto/man/d2i_X509_CRL.3
+++ b/src/lib/libcrypto/man/d2i_X509_CRL.3
@@ -1,7 +1,6 @@
1.\" $OpenBSD: d2i_X509_CRL.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: d2i_X509_CRL.3,v 1.8 2021/10/30 16:20:35 schwarze Exp $
2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" 2.\"
4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org>
5.\" 4.\"
6.\" Permission to use, copy, modify, and distribute this software for any 5.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above 6.\" purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +14,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 16.\"
18.Dd $Mdocdate: March 27 2018 $ 17.Dd $Mdocdate: October 30 2021 $
19.Dt D2I_X509_CRL 3 18.Dt D2I_X509_CRL 3
20.Os 19.Os
21.Sh NAME 20.Sh NAME
@@ -96,6 +95,16 @@ and
96decode and encode an ASN.1 95decode and encode an ASN.1
97.Vt CertificateList 96.Vt CertificateList
98structure defined in RFC 5280 section 5.1. 97structure defined in RFC 5280 section 5.1.
98.Pp
99If
100.Xr X509_CRL_set_default_method 3
101is in effect and the
102.Fn crl_init
103callback is not
104.Dv NULL ,
105that callback is invoked at the end of
106.Fn d2i_X509_CRL .
107.Pp
99.Fn d2i_X509_CRL_bio , 108.Fn d2i_X509_CRL_bio ,
100.Fn d2i_X509_CRL_fp , 109.Fn d2i_X509_CRL_fp ,
101.Fn i2d_X509_CRL_bio , 110.Fn i2d_X509_CRL_bio ,
@@ -123,6 +132,7 @@ the revokedCertificates field of the ASN.1
123structure. 132structure.
124.Sh SEE ALSO 133.Sh SEE ALSO
125.Xr ASN1_item_d2i 3 , 134.Xr ASN1_item_d2i 3 ,
135.Xr X509_CRL_METHOD_new 3 ,
126.Xr X509_CRL_new 3 , 136.Xr X509_CRL_new 3 ,
127.Xr X509_REVOKED_new 3 137.Xr X509_REVOKED_new 3
128.Sh STANDARDS 138.Sh STANDARDS