1 .\" $OpenBSD: SSL_CTX_set_tlsext_status_cb.3,v 1.1 2016/12/01 21:12:49 schwarze Exp $
2 .\" OpenSSL 43c34894 Nov 30 16:04:51 2015 +0000
4 .\" This file was written by Matt Caswell <matt@openssl.org>.
5 .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in
16 .\" the documentation and/or other materials provided with the
19 .\" 3. All advertising materials mentioning features or use of this
20 .\" software must display the following acknowledgment:
21 .\" "This product includes software developed by the OpenSSL Project
22 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25 .\" endorse or promote products derived from this software without
26 .\" prior written permission. For written permission, please contact
27 .\" openssl-core@openssl.org.
29 .\" 5. Products derived from this software may not be called "OpenSSL"
30 .\" nor may "OpenSSL" appear in their names without prior written
31 .\" permission of the OpenSSL Project.
33 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\" "This product includes software developed by the OpenSSL Project
36 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
51 .Dd $Mdocdate: December 1 2016 $
52 .Dt SSL_CTX_SET_TLSEXT_STATUS_CB 3
55 .Nm SSL_CTX_set_tlsext_status_cb ,
56 .Nm SSL_CTX_set_tlsext_status_arg ,
57 .Nm SSL_set_tlsext_status_type ,
58 .Nm SSL_get_tlsext_status_ocsp_resp ,
59 .Nm SSL_set_tlsext_status_ocsp_resp
60 .Nd OCSP Certificate Status Request functions
64 .Fo SSL_CTX_set_tlsext_status_cb
66 .Fa "int (*callback)(SSL *, void *)"
69 .Fo SSL_CTX_set_tlsext_status_arg
74 .Fo SSL_set_tlsext_status_type
79 .Fo SSL_get_tlsext_status_ocsp_resp
81 .Fa "unsigned char **resp"
84 .Fo SSL_set_tlsext_status_ocsp_resp
86 .Fa "unsigned char *resp"
90 A client application may request that a server send back an OCSP status
91 response (also known as OCSP stapling).
92 To do so the client should call the
93 .Fn SSL_set_tlsext_status_type
94 function on an individual
96 object prior to the start of the handshake.
97 Currently the only supported type is
98 .Dv TLSEXT_STATUSTYPE_ocsp .
99 This value should be passed in the
103 The client should additionally provide a callback function to decide
104 what to do with the returned OCSP response by calling
105 .Fn SSL_CTX_set_tlsext_status_cb .
106 The callback function should determine whether the returned OCSP
107 response is acceptable or not.
108 The callback will be passed as an argument the value previously set via
110 .Fn SSL_CTX_set_tlsext_status_arg .
111 Note that the callback will not be called in the event of a handshake
112 where session resumption occurs (because there are no Certificates
113 exchanged in such a handshake).
115 The response returned by the server can be obtained via a call to
116 .Fn SSL_get_tlsext_status_ocsp_resp .
119 will be updated to point to the OCSP response data and the return value
120 will be the length of that data.
121 If the server has not provided any response data, then
125 and the return value from
126 .Fn SSL_get_tlsext_status_ocsp_resp
129 A server application must also call the
130 .Fn SSL_CTX_set_tlsext_status_cb
131 function if it wants to be able to provide clients with OCSP Certificate
133 Typically the server callback would obtain the server certificate that
134 is being sent back to the client via a call to
135 .Xr SSL_get_certificate 3 ,
136 obtain the OCSP response to be sent back, and then set that response
138 .Fn SSL_set_tlsext_status_ocsp_resp .
139 A pointer to the response data should be provided in the
141 argument, and the length of that data should be in the
145 The callback when used on the client side should return a negative
146 value on error, 0 if the response is not acceptable (in which case
147 the handshake will fail), or a positive value if it is acceptable.
149 The callback when used on the server side should return with either
150 .Dv SSL_TLSEXT_ERR_OK
151 (meaning that the OCSP response that has been set should be returned),
152 .Dv SSL_TLSEXT_ERR_NOACK
153 (meaning that an OCSP response should not be returned), or
154 .Dv SSL_TLSEXT_ERR_ALERT_FATAL
155 (meaning that a fatal error has occurred).
157 .Fn SSL_CTX_set_tlsext_status_cb ,
158 .Fn SSL_CTX_set_tlsext_status_arg ,
159 .Fn SSL_set_tlsext_status_type ,
161 .Fn SSL_set_tlsext_status_ocsp_resp
162 return 0 on error or 1 on success.
164 .Fn SSL_get_tlsext_status_ocsp_resp
165 returns the length of the OCSP response data or -1 if there is no OCSP