summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2021-11-16 12:06:57 +0000
committerschwarze <>2021-11-16 12:06:57 +0000
commit56ed22a253a0763d163d6b3824960378ba6764d8 (patch)
treefc9314d01dd50f15d63dc495d6363085af0acf0f /src/lib
parent472274904c17498946215c2545718b52f7838782 (diff)
downloadopenbsd-56ed22a253a0763d163d6b3824960378ba6764d8.tar.gz
openbsd-56ed22a253a0763d163d6b3824960378ba6764d8.tar.bz2
openbsd-56ed22a253a0763d163d6b3824960378ba6764d8.zip
Recently, tb@ provided the following functions:
X509_STORE_CTX_set_error_depth x509_vfy.h 1.37 x509_vfy.c 1.91 X509_STORE_CTX_set_current_cert x509_vfy.h 1.37 x509_vfy.c 1.91 X509_STORE_CTX_get_num_untrusted x509_vfy.h 1.36 x509_vfy.c 1.90 X509_STORE_CTX_set0_verified_chain x509_vfy.h 1.37 x509_vfy.c 1.91 Merge the documentation from the OpenSSL 1.1.1 branch, which is still under a free license; tweaked by me.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_get_error.375
1 files changed, 71 insertions, 4 deletions
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
index c97e60330b..36ea311dce 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
@@ -1,7 +1,5 @@
1.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.18 2021/07/29 09:14:23 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.19 2021/11/16 12:06:57 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL crypto/X509_STORE_CTX_get_error f0e0fd51 Apr 14 23:59:26 2016 -0400
4.\" selective merge up to:
5.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100 3.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100
6.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100 4.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100
7.\" 5.\"
@@ -70,20 +68,24 @@
70.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
71.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
72.\" 70.\"
73.Dd $Mdocdate: July 29 2021 $ 71.Dd $Mdocdate: November 16 2021 $
74.Dt X509_STORE_CTX_GET_ERROR 3 72.Dt X509_STORE_CTX_GET_ERROR 3
75.Os 73.Os
76.Sh NAME 74.Sh NAME
77.Nm X509_STORE_CTX_get_error , 75.Nm X509_STORE_CTX_get_error ,
78.Nm X509_STORE_CTX_set_error , 76.Nm X509_STORE_CTX_set_error ,
79.Nm X509_STORE_CTX_get_error_depth , 77.Nm X509_STORE_CTX_get_error_depth ,
78.Nm X509_STORE_CTX_set_error_depth ,
80.Nm X509_STORE_CTX_get_current_cert , 79.Nm X509_STORE_CTX_get_current_cert ,
80.Nm X509_STORE_CTX_set_current_cert ,
81.Nm X509_STORE_CTX_get0_current_issuer , 81.Nm X509_STORE_CTX_get0_current_issuer ,
82.Nm X509_STORE_CTX_get0_current_crl , 82.Nm X509_STORE_CTX_get0_current_crl ,
83.Nm X509_STORE_CTX_get0_parent_ctx , 83.Nm X509_STORE_CTX_get0_parent_ctx ,
84.Nm X509_STORE_CTX_get_num_untrusted ,
84.Nm X509_STORE_CTX_get0_chain , 85.Nm X509_STORE_CTX_get0_chain ,
85.Nm X509_STORE_CTX_get_chain , 86.Nm X509_STORE_CTX_get_chain ,
86.Nm X509_STORE_CTX_get1_chain , 87.Nm X509_STORE_CTX_get1_chain ,
88.Nm X509_STORE_CTX_set0_verified_chain ,
87.Nm X509_STORE_CTX_get0_policy_tree , 89.Nm X509_STORE_CTX_get0_policy_tree ,
88.Nm X509_STORE_CTX_get_explicit_policy , 90.Nm X509_STORE_CTX_get_explicit_policy ,
89.Nm X509_verify_cert_error_string 91.Nm X509_verify_cert_error_string
@@ -103,10 +105,20 @@
103.Fo X509_STORE_CTX_get_error_depth 105.Fo X509_STORE_CTX_get_error_depth
104.Fa "X509_STORE_CTX *ctx" 106.Fa "X509_STORE_CTX *ctx"
105.Fc 107.Fc
108.Ft void
109.Fo X509_STORE_CTX_set_error_depth
110.Fa "X509_STORE_CTX *ctx"
111.Fa "int depth"
112.Fc
106.Ft X509 * 113.Ft X509 *
107.Fo X509_STORE_CTX_get_current_cert 114.Fo X509_STORE_CTX_get_current_cert
108.Fa "X509_STORE_CTX *ctx" 115.Fa "X509_STORE_CTX *ctx"
109.Fc 116.Fc
117.Ft void
118.Fo X509_STORE_CTX_set_current_cert
119.Fa "X509_STORE_CTX *ctx"
120.Fa "X509 *cert"
121.Fc
110.Ft X509 * 122.Ft X509 *
111.Fo X509_STORE_CTX_get0_current_issuer 123.Fo X509_STORE_CTX_get0_current_issuer
112.Fa "X509_STORE_CTX *ctx" 124.Fa "X509_STORE_CTX *ctx"
@@ -119,6 +131,10 @@
119.Fo X509_STORE_CTX_get0_parent_ctx 131.Fo X509_STORE_CTX_get0_parent_ctx
120.Fa "X509_STORE_CTX *ctx" 132.Fa "X509_STORE_CTX *ctx"
121.Fc 133.Fc
134.Ft int
135.Fo X509_STORE_CTX_get_num_untrusted
136.Fa "X509_STORE_CTX *ctx"
137.Fc
122.Ft STACK_OF(X509) * 138.Ft STACK_OF(X509) *
123.Fo X509_STORE_CTX_get0_chain 139.Fo X509_STORE_CTX_get0_chain
124.Fa "X509_STORE_CTX *ctx" 140.Fa "X509_STORE_CTX *ctx"
@@ -131,6 +147,11 @@
131.Fo X509_STORE_CTX_get1_chain 147.Fo X509_STORE_CTX_get1_chain
132.Fa "X509_STORE_CTX *ctx" 148.Fa "X509_STORE_CTX *ctx"
133.Fc 149.Fc
150.Ft void
151.Fo X509_STORE_CTX_set0_verified_chain
152.Fa "X509_STORE_CTX *ctx"
153.Fa "STACK_OF(X509) *chain"
154.Fc
134.Ft X509_POLICY_TREE * 155.Ft X509_POLICY_TREE *
135.Fo X509_STORE_CTX_get0_policy_tree 156.Fo X509_STORE_CTX_get0_policy_tree
136.Fa "X509_STORE_CTX *ctx" 157.Fa "X509_STORE_CTX *ctx"
@@ -173,6 +194,12 @@ chain the error occurred.
173If it is zero, it occurred in the end entity certificate, one if it is 194If it is zero, it occurred in the end entity certificate, one if it is
174the certificate which signed the end entity certificate, and so on. 195the certificate which signed the end entity certificate, and so on.
175.Pp 196.Pp
197.Fn X509_STORE_CTX_set_error_depth
198sets the error depth.
199This can be used in combination with
200.Fn X509_STORE_CTX_set_error
201to set the depth at which an error condition was detected.
202.Pp
176.Fn X509_STORE_CTX_get_current_cert 203.Fn X509_STORE_CTX_get_current_cert
177returns the certificate in 204returns the certificate in
178.Fa ctx 205.Fa ctx
@@ -180,6 +207,22 @@ which caused the error or
180.Dv NULL 207.Dv NULL
181if no certificate is relevant. 208if no certificate is relevant.
182.Pp 209.Pp
210.Fn X509_STORE_CTX_set_current_cert
211sets the certificate which caused the error in
212.Fa ctx
213to the given
214.Fa cert .
215This value is not intended to remain valid for very long,
216and remains owned by the caller.
217It may be examined by a verification callback invoked to handle
218each error encountered during chain verification and is no longer
219required after such a callback.
220If a callback wishes the save the certificate for use after it returns,
221it needs to increment its reference count via
222.Xr X509_up_ref 3 .
223Once such a saved certificate is no longer needed, it can be freed with
224.Xr X509_free 3 .
225.Pp
183.Fn X509_STORE_CTX_get0_current_issuer 226.Fn X509_STORE_CTX_get0_current_issuer
184returns the certificate that caused issuer validation to fail or 227returns the certificate that caused issuer validation to fail or
185.Dv NULL 228.Dv NULL
@@ -224,6 +267,17 @@ structure is freed.
224When it is no longer needed, it should be freed using 267When it is no longer needed, it should be freed using
225.Fn sk_X509_pop_free chain X509_free . 268.Fn sk_X509_pop_free chain X509_free .
226.Pp 269.Pp
270.Fn X509_STORE_CTX_set0_verified_chain
271frees the validate chain generated by if a previous call to
272.Xr X509_verify_cert 3 ,
273if any, and replaces it with the given
274.Fa chain .
275Ownership of the
276.Fa chain
277is transferred to the
278.Fa ctx ,
279so it should not be freed by the caller.
280.Pp
227.Fn X509_verify_cert_error_string 281.Fn X509_verify_cert_error_string
228returns a human readable error string for verification error 282returns a human readable error string for verification error
229.Fa n . 283.Fa n .
@@ -270,6 +324,11 @@ if
270is not a temporary child context 324is not a temporary child context
271used for path validation of a CRL issuer certificate. 325used for path validation of a CRL issuer certificate.
272.Pp 326.Pp
327.Fn X509_STORE_CTX_get_num_untrusted
328returns the number of untrusted certificates
329that were used in building the chain during a call to
330.Xr X509_verify_cert 3 .
331.Pp
273.Fn X509_STORE_CTX_get0_chain , 332.Fn X509_STORE_CTX_get0_chain ,
274.Fn X509_STORE_CTX_get_chain , 333.Fn X509_STORE_CTX_get_chain ,
275and 334and
@@ -506,3 +565,11 @@ first appeared in OpenSSL 1.0.0 and have been available since
506.Fn X509_STORE_CTX_get0_chain 565.Fn X509_STORE_CTX_get0_chain
507first appeared in OpenSSL 1.1.0 and has been available since 566first appeared in OpenSSL 1.1.0 and has been available since
508.Ox 6.3 . 567.Ox 6.3 .
568.Pp
569.Fn X509_STORE_CTX_set_error_depth ,
570.Fn X509_STORE_CTX_set_current_cert ,
571.Fn X509_STORE_CTX_get_num_untrusted ,
572and
573.Fn X509_STORE_CTX_set0_verified_chain
574first appeared in OpenSSL 1.1.0 and have been available since
575.Ox 7.1 .