SSL_get_version.pod 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. =pod
  2. =head1 NAME
  3. SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_is_tls, SSL_is_quic,
  4. SSL_version - get the protocol information of a connection
  5. =head1 SYNOPSIS
  6. #include <openssl/ssl.h>
  7. int SSL_client_version(const SSL *s);
  8. const char *SSL_get_version(const SSL *ssl);
  9. int SSL_is_dtls(const SSL *ssl);
  10. int SSL_is_tls(const SSL *ssl);
  11. int SSL_is_quic(const SSL *ssl);
  12. int SSL_version(const SSL *s);
  13. =head1 DESCRIPTION
  14. For SSL, TLS and DTLS protocols SSL_client_version() returns the numeric
  15. protocol version advertised by the client in the legacy_version field of the
  16. ClientHello when initiating the connection. Note that, for TLS, this value
  17. will never indicate a version greater than TLSv1.2 even if TLSv1.3 is
  18. subsequently negotiated. For QUIC connections it returns OSSL_QUIC1_VERSION.
  19. SSL_get_version() returns the name of the protocol used for the connection.
  20. SSL_version() returns the numeric protocol version used for the connection.
  21. They should only be called after the initial handshake has been completed.
  22. Prior to that the results returned from these functions may be unreliable.
  23. SSL_is_dtls() returns 1 if the connection is using DTLS or 0 if not.
  24. SSL_is_tls() returns 1 if the connection is using SSL/TLS or 0 if not.
  25. SSL_is_quic() returns 1 if the connection is using QUIC or 0 if not.
  26. =head1 RETURN VALUES
  27. SSL_get_version() returns one of the following strings:
  28. =over 4
  29. =item SSLv3
  30. The connection uses the SSLv3 protocol.
  31. =item TLSv1
  32. The connection uses the TLSv1.0 protocol.
  33. =item TLSv1.1
  34. The connection uses the TLSv1.1 protocol.
  35. =item TLSv1.2
  36. The connection uses the TLSv1.2 protocol.
  37. =item TLSv1.3
  38. The connection uses the TLSv1.3 protocol.
  39. =item DTLSv0.9
  40. The connection uses an obsolete pre-standardisation DTLS protocol
  41. =item DTLSv1
  42. The connection uses the DTLSv1 protocol
  43. =item DTLSv1.2
  44. The connection uses the DTLSv1.2 protocol
  45. =item QUICv1
  46. The connection uses the QUICv1 protocol.
  47. =item unknown
  48. This indicates an unknown protocol version.
  49. =back
  50. SSL_version() and SSL_client_version() return an integer which could include any
  51. of the following:
  52. =over 4
  53. =item SSL3_VERSION
  54. The connection uses the SSLv3 protocol.
  55. =item TLS1_VERSION
  56. The connection uses the TLSv1.0 protocol.
  57. =item TLS1_1_VERSION
  58. The connection uses the TLSv1.1 protocol.
  59. =item TLS1_2_VERSION
  60. The connection uses the TLSv1.2 protocol.
  61. =item TLS1_3_VERSION
  62. The connection uses the TLSv1.3 protocol (never returned for
  63. SSL_client_version()).
  64. =item DTLS1_BAD_VER
  65. The connection uses an obsolete pre-standardisation DTLS protocol
  66. =item DTLS1_VERSION
  67. The connection uses the DTLSv1 protocol
  68. =item DTLS1_2_VERSION
  69. The connection uses the DTLSv1.2 protocol
  70. =item OSSL_QUIC1_VERSION
  71. The connection uses the QUICv1 protocol.
  72. =back
  73. =head1 SEE ALSO
  74. L<ssl(7)>
  75. =head1 HISTORY
  76. The SSL_is_dtls() function was added in OpenSSL 1.1.0. The SSL_is_tls() and
  77. SSL_is_quic() functions were added in OpenSSL 3.2.
  78. =head1 COPYRIGHT
  79. Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
  80. Licensed under the Apache License 2.0 (the "License"). You may not use
  81. this file except in compliance with the License. You can obtain a copy
  82. in the file LICENSE in the source distribution or at
  83. L<https://www.openssl.org/source/license.html>.
  84. =cut