import libssl (LibreSSL 2.5.4)
[unleashed.git] / lib / libssl / man / SSL_CTX_set_tlsext_status_cb.3
blob7fdd816cc3ce234586b7870c4643b76d98aa40c2
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
3 .\"
4 .\" This file was written by Matt Caswell <matt@openssl.org>.
5 .\" Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\"
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
17 .\"    distribution.
18 .\"
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/)"
23 .\"
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.
28 .\"
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.
32 .\"
33 .\" 6. Redistributions of any form whatsoever must retain the following
34 .\"    acknowledgment:
35 .\"    "This product includes software developed by the OpenSSL Project
36 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37 .\"
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.
50 .\"
51 .Dd $Mdocdate: December 1 2016 $
52 .Dt SSL_CTX_SET_TLSEXT_STATUS_CB 3
53 .Os
54 .Sh NAME
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
61 .Sh SYNOPSIS
62 .In openssl/tls1.h
63 .Ft long
64 .Fo SSL_CTX_set_tlsext_status_cb
65 .Fa "SSL_CTX *ctx"
66 .Fa "int (*callback)(SSL *, void *)"
67 .Fc
68 .Ft long
69 .Fo SSL_CTX_set_tlsext_status_arg
70 .Fa "SSL_CTX *ctx"
71 .Fa "void *arg"
72 .Fc
73 .Ft long
74 .Fo SSL_set_tlsext_status_type
75 .Fa "SSL *s"
76 .Fa "int type"
77 .Fc
78 .Ft long
79 .Fo SSL_get_tlsext_status_ocsp_resp
80 .Fa ssl
81 .Fa "unsigned char **resp"
82 .Fc
83 .Ft long
84 .Fo SSL_set_tlsext_status_ocsp_resp
85 .Fa ssl
86 .Fa "unsigned char *resp"
87 .Fa "int len"
88 .Fc
89 .Sh DESCRIPTION
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
95 .Vt SSL
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
100 .Fa type
101 argument.
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
109 a call to
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 .
117 The value
118 .Pf * Fa 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
122 .Pf * Fa resp
123 will be
124 .Dv NULL
125 and the return value from
126 .Fn SSL_get_tlsext_status_ocsp_resp
127 will be -1.
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
132 Status responses.
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
137 data by calling
138 .Fn SSL_set_tlsext_status_ocsp_resp .
139 A pointer to the response data should be provided in the
140 .Fa resp
141 argument, and the length of that data should be in the
142 .Fa len
143 argument.
144 .Sh RETURN VALUES
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
166 response data.