SSL_CTX_set_mode.pod 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_mode, SSL_set_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. long SSL_CTX_set_mode(SSL_CTX *ctx, long mode);
  7. long SSL_set_mode(SSL *ssl, long mode);
  8. long SSL_CTX_get_mode(SSL_CTX *ctx);
  9. long SSL_get_mode(SSL *ssl);
  10. =head1 DESCRIPTION
  11. SSL_CTX_set_mode() adds the mode set via bitmask in B<mode> to B<ctx>.
  12. Options already set before are not cleared.
  13. SSL_set_mode() adds the mode set via bitmask in B<mode> to B<ssl>.
  14. Options already set before are not cleared.
  15. SSL_CTX_get_mode() returns the mode set for B<ctx>.
  16. SSL_get_mode() returns the mode set for B<ssl>.
  17. =head1 NOTES
  18. The following mode changes are available:
  19. =over 4
  20. =item SSL_MODE_ENABLE_PARTIAL_WRITE
  21. Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
  22. when just a single record has been written). When not set (the default),
  23. SSL_write() will only report success once the complete chunk was written.
  24. Once SSL_write() returns with r, r bytes have been successfully written
  25. and the next call to SSL_write() must only send the n-r bytes left,
  26. imitating the behaviour of write().
  27. =item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
  28. Make it possible to retry SSL_write() with changed buffer location
  29. (the buffer contents must stay the same). This is not the default to avoid
  30. the misconception that non-blocking SSL_write() behaves like
  31. non-blocking write().
  32. =item SSL_MODE_AUTO_RETRY
  33. Never bother the application with retries if the transport is blocking.
  34. If a renegotiation take place during normal operation, a
  35. L<SSL_read(3)|SSL_read(3)> or L<SSL_write(3)|SSL_write(3)> would return
  36. with -1 and indicate the need to retry with SSL_ERROR_WANT_READ.
  37. In a non-blocking environment applications must be prepared to handle
  38. incomplete read/write operations.
  39. In a blocking environment, applications are not always prepared to
  40. deal with read/write operations returning without success report. The
  41. flag SSL_MODE_AUTO_RETRY will cause read/write operations to only
  42. return after the handshake and successful completion.
  43. =item SSL_MODE_RELEASE_BUFFERS
  44. When we no longer need a read buffer or a write buffer for a given SSL,
  45. then release the memory we were using to hold it. Released memory is
  46. either appended to a list of unused RAM chunks on the SSL_CTX, or simply
  47. freed if the list of unused chunks would become longer than
  48. SSL_CTX->freelist_max_len, which defaults to 32. Using this flag can
  49. save around 34k per idle SSL connection.
  50. This flag has no effect on SSL v2 connections, or on DTLS connections.
  51. =item SSL_MODE_SEND_FALLBACK_SCSV
  52. Send TLS_FALLBACK_SCSV in the ClientHello.
  53. To be set only by applications that reconnect with a downgraded protocol
  54. version; see draft-ietf-tls-downgrade-scsv-00 for details.
  55. DO NOT ENABLE THIS if your application attempts a normal handshake.
  56. Only use this in explicit fallback retries, following the guidance
  57. in draft-ietf-tls-downgrade-scsv-00.
  58. =back
  59. =head1 RETURN VALUES
  60. SSL_CTX_set_mode() and SSL_set_mode() return the new mode bitmask
  61. after adding B<mode>.
  62. SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask.
  63. =head1 SEE ALSO
  64. L<ssl(3)|ssl(3)>, L<SSL_read(3)|SSL_read(3)>, L<SSL_write(3)|SSL_write(3)>
  65. =head1 HISTORY
  66. SSL_MODE_AUTO_RETRY as been added in OpenSSL 0.9.6.
  67. =cut