Add requested HISTORY section, remove copy/pastos, per review feedback.
[openssl.git] / doc / ssl / SSL_CTX_set_tlsext_status_cb.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_CTX_set_tlsext_status_cb, SSL_CTX_set_tlsext_status_arg,
6 SSL_CTX_set_tlsext_status_type, SSL_set_tlsext_status_type,
7 SSL_get_tlsext_status_ocsp_resp, SSL_set_tlsext_status_ocsp_resp - OCSP
8 Certificate Status Request functions
9
10 =head1 SYNOPSIS
11
12  #include <openssl/tls1.h>
13
14  long SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx,
15                                    int (*callback)(SSL *, void *));
16  long SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);
17
18  long SSL_CTX_set_tlsext_status_type(SSL_CTX *ctx, int type);
19
20  long SSL_set_tlsext_status_type(SSL *s, int type);
21
22  long SSL_get_tlsext_status_ocsp_resp(ssl, unsigned char **resp);
23  long SSL_set_tlsext_status_ocsp_resp(ssl, unsigned char *resp, int len);
24
25 =head1 DESCRIPTION
26
27 A client application may request that a server send back an OCSP status response
28 (also known as OCSP stapling). To do so the client should call the
29 SSL_CTX_set_tlsext_status_type() function prior to the creation of any SSL
30 objects. Alternatively an application can call the SSL_set_tlsext_status_type()
31 function on an individual SSL object prior to the start of the handshake.
32 Currently the only supported type is B<TLSEXT_STATUSTYPE_ocsp>. This value
33 should be passed in the B<type> argument.
34
35 The client should additionally provide a callback function to decide what to do
36 with the returned OCSP response by calling SSL_CTX_set_tlsext_status_cb(). The
37 callback function should determine whether the returned OCSP response is
38 acceptable or not. The callback will be passed as an argument the value
39 previously set via a call to SSL_CTX_set_tlsext_status_arg(). Note that the
40 callback will not be called in the event of a handshake where session resumption
41 occurs (because there are no Certificates exchanged in such a handshake).
42
43 The response returned by the server can be obtained via a call to
44 SSL_get_tlsext_status_ocsp_resp(). The value B<*resp> will be updated to point
45 to the OCSP response data and the return value will be the length of that data.
46 Typically a callback would obtain an OCSP_RESPONSE object from this data via a
47 call to the d2i_OCSP_RESPONSE() function. If the server has not provided any
48 response data then B<*resp> will be NULL and the return value from
49 SSL_get_tlsext_status_ocsp_resp() will be -1.
50
51 A server application must also call the SSL_CTX_set_tlsext_status_cb() function
52 if it wants to be able to provide clients with OCSP Certificate Status
53 responses. Typically the server callback would obtain the server certificate
54 that is being sent back to the client via a call to SSL_get_certificate();
55 obtain the OCSP response to be sent back; and then set that response data by
56 calling SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data should
57 be provided in the B<resp> argument, and the length of that data should be in
58 the B<len> argument.
59
60 =head1 RETURN VALUES
61
62 The callback when used on the client side should return a negative value on
63 error; 0 if the response is not acceptable (in which case the handshake will
64 fail) or a positive value if it is acceptable.
65
66 The callback when used on the server side should return with either
67 SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set should be
68 returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP response should not be
69 returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning that a fatal error has
70 occurred).
71
72 SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(),
73 SSL_CTX_set_tlsext_status_type(), SSL_set_tlsext_status_type() and
74 SSL_set_tlsext_status_ocsp_resp() return 0 on error or 1 on success.
75
76 SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP response data
77 or -1 if there is no OCSP response data.
78
79 =head1 HISTORY
80
81 SSL_CTX_set_tlsext_status_type() was added in OpenSSL 1.1.0.
82
83 =head1 COPYRIGHT
84
85 Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
86
87 Licensed under the OpenSSL license (the "License").  You may not use
88 this file except in compliance with the License.  You can obtain a copy
89 in the file LICENSE in the source distribution or at
90 L<https://www.openssl.org/source/license.html>.
91
92 =cut