SSL_CTX_set_stateless_cookie_generate_cb.pod 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_stateless_cookie_generate_cb,
  4. SSL_CTX_set_stateless_cookie_verify_cb,
  5. SSL_CTX_set_cookie_generate_cb,
  6. SSL_CTX_set_cookie_verify_cb
  7. - Callback functions for stateless TLS1.3 cookies
  8. =head1 SYNOPSIS
  9. #include <openssl/ssl.h>
  10. void SSL_CTX_set_stateless_cookie_generate_cb(
  11. SSL_CTX *ctx,
  12. int (*gen_stateless_cookie_cb) (SSL *ssl,
  13. unsigned char *cookie,
  14. size_t *cookie_len));
  15. void SSL_CTX_set_stateless_cookie_verify_cb(
  16. SSL_CTX *ctx,
  17. int (*verify_stateless_cookie_cb) (SSL *ssl,
  18. const unsigned char *cookie,
  19. size_t cookie_len));
  20. void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
  21. int (*app_gen_cookie_cb) (SSL *ssl,
  22. unsigned char
  23. *cookie,
  24. unsigned int
  25. *cookie_len));
  26. void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
  27. int (*app_verify_cookie_cb) (SSL *ssl,
  28. const unsigned
  29. char *cookie,
  30. unsigned int
  31. cookie_len));
  32. =head1 DESCRIPTION
  33. SSL_CTX_set_stateless_cookie_generate_cb() sets the callback used by
  34. L<SSL_stateless(3)> to generate the application-controlled portion of the cookie
  35. provided to clients in the HelloRetryRequest transmitted as a response to a
  36. ClientHello with a missing or invalid cookie. gen_stateless_cookie_cb() must
  37. write at most SSL_COOKIE_LENGTH bytes into B<cookie>, and must write the number
  38. of bytes written to B<cookie_len>. If a cookie cannot be generated, a zero
  39. return value can be used to abort the handshake.
  40. SSL_CTX_set_stateless_cookie_verify_cb() sets the callback used by
  41. L<SSL_stateless(3)> to determine whether the application-controlled portion of a
  42. ClientHello cookie is valid. The cookie data is pointed to by B<cookie> and is of
  43. length B<cookie_len>. A nonzero return value from verify_stateless_cookie_cb()
  44. communicates that the cookie is valid. The integrity of the entire cookie,
  45. including the application-controlled portion, is automatically verified by HMAC
  46. before verify_stateless_cookie_cb() is called.
  47. SSL_CTX_set_cookie_generate_cb() sets the callback used by L<DTLSv1_listen(3)>
  48. to generate the cookie provided to clients in the HelloVerifyRequest transmitted
  49. as a response to a ClientHello with a missing or invalid cookie.
  50. app_gen_cookie_cb() must write at most DTLS1_COOKIE_LENGTH bytes into
  51. B<cookie>, and must write the number of bytes written to B<cookie_len>. If a
  52. cookie cannot be generated, a zero return value can be used to abort the
  53. handshake.
  54. SSL_CTX_set_cookie_verify_cb() sets the callback used by L<DTLSv1_listen(3)> to
  55. determine whether the cookie in a ClientHello is valid. The cookie data is
  56. pointed to by B<cookie> and is of length B<cookie_len>. A nonzero return value
  57. from app_verify_cookie_cb() communicates that the cookie is valid. The
  58. integrity of the cookie is not verified by OpenSSL. This is an application
  59. responsibility.
  60. =head1 RETURN VALUES
  61. Neither function returns a value.
  62. =head1 SEE ALSO
  63. L<ssl(7)>,
  64. L<SSL_stateless(3)>,
  65. L<DTLSv1_listen(3)>
  66. =head1 HISTORY
  67. SSL_CTX_set_stateless_cookie_generate_cb() and
  68. SSL_CTX_set_stateless_cookie_verify_cb() were added in OpenSSL 1.1.1.
  69. =head1 COPYRIGHT
  70. Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
  71. Licensed under the Apache License 2.0 (the "License"). You may not use
  72. this file except in compliance with the License. You can obtain a copy
  73. in the file LICENSE in the source distribution or at
  74. L<https://www.openssl.org/source/license.html>.
  75. =cut