SSL_CTX_set_tlsext_status_cb.pod 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_tlsext_status_cb, SSL_CTX_set_tlsext_status_arg,
  4. SSL_set_tlsext_status_type, SSL_get_tlsext_status_ocsp_resp,
  5. SSL_set_tlsext_status_ocsp_resp - OCSP Certificate Status Request functions
  6. =head1 SYNOPSIS
  7. #include <openssl/tls1.h>
  8. long SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx,
  9. int (*callback)(SSL *, void *));
  10. long SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);
  11. long SSL_set_tlsext_status_type(SSL *s, int type);
  12. long SSL_get_tlsext_status_ocsp_resp(ssl, unsigned char **resp);
  13. long SSL_set_tlsext_status_ocsp_resp(ssl, unsigned char *resp, int len);
  14. =head1 DESCRIPTION
  15. A client application may request that a server send back an OCSP status response
  16. (also known as OCSP stapling). To do so the client should call the
  17. SSL_set_tlsext_status_type() function prior to the start of the handshake.
  18. Currently the only supported type is B<TLSEXT_STATUSTYPE_ocsp>. This value
  19. should be passed in the B<type> argument. The client should additionally provide
  20. a callback function to decide what to do with the returned OCSP response by
  21. calling SSL_CTX_set_tlsext_status_cb(). The callback function should determine
  22. whether the returned OCSP response is acceptable or not. The callback will be
  23. passed as an argument the value previously set via a call to
  24. SSL_CTX_set_tlsext_status_arg(). Note that the callback will not be called in
  25. the event of a handshake where session resumption occurs (because there are no
  26. Certificates exchanged in such a handshake).
  27. The response returned by the server can be obtained via a call to
  28. SSL_get_tlsext_status_ocsp_resp(). The value B<*resp> will be updated to point
  29. to the OCSP response data and the return value will be the length of that data.
  30. Typically a callback would obtain an OCSP_RESPONSE object from this data via a
  31. call to the d2i_OCSP_RESPONSE() function. If the server has not provided any
  32. response data then B<*resp> will be NULL and the return value from
  33. SSL_get_tlsext_status_ocsp_resp() will be -1.
  34. A server application must also call the SSL_CTX_set_tlsext_status_cb() function
  35. if it wants to be able to provide clients with OCSP Certificate Status
  36. responses. Typically the server callback would obtain the server certificate
  37. that is being sent back to the client via a call to SSL_get_certificate();
  38. obtain the OCSP response to be sent back; and then set that response data by
  39. calling SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data should
  40. be provided in the B<resp> argument, and the length of that data should be in
  41. the B<len> argument.
  42. =head1 RETURN VALUES
  43. The callback when used on the client side should return a negative value on
  44. error; 0 if the response is not acceptable (in which case the handshake will
  45. fail) or a positive value if it is acceptable.
  46. The callback when used on the server side should return with either
  47. SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set should be
  48. returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP response should not be
  49. returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning that a fatal error has
  50. occurred).
  51. SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(),
  52. SSL_set_tlsext_status_type() and SSL_set_tlsext_status_ocsp_resp() return 0 on
  53. error or 1 on success.
  54. SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP response data
  55. or -1 if there is no OCSP response data.
  56. =cut