SSL_get_version.pod 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. =pod
  2. =head1 NAME
  3. SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_version - get the
  4. 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_version(const SSL *s);
  11. =head1 DESCRIPTION
  12. SSL_client_version() returns the numeric protocol version advertised by the
  13. client in the legacy_version field of the ClientHello when initiating the
  14. connection. Note that, for TLS, this value will never indicate a version greater
  15. than TLSv1.2 even if TLSv1.3 is subsequently negotiated. SSL_get_version()
  16. returns the name of the protocol used for the connection. SSL_version() returns
  17. the numeric protocol version used for the connection. They should only be called
  18. after the initial handshake has been completed. Prior to that the results
  19. returned from these functions may be unreliable.
  20. SSL_is_dtls() returns one if the connection is using DTLS, zero if not.
  21. =head1 RETURN VALUES
  22. SSL_get_version() returns one of the following strings:
  23. =over 4
  24. =item SSLv3
  25. The connection uses the SSLv3 protocol.
  26. =item TLSv1
  27. The connection uses the TLSv1.0 protocol.
  28. =item TLSv1.1
  29. The connection uses the TLSv1.1 protocol.
  30. =item TLSv1.2
  31. The connection uses the TLSv1.2 protocol.
  32. =item TLSv1.3
  33. The connection uses the TLSv1.3 protocol.
  34. =item unknown
  35. This indicates an unknown protocol version.
  36. =back
  37. SSL_version() and SSL_client_version() return an integer which could include any
  38. of the following:
  39. =over 4
  40. =item SSL3_VERSION
  41. The connection uses the SSLv3 protocol.
  42. =item TLS1_VERSION
  43. The connection uses the TLSv1.0 protocol.
  44. =item TLS1_1_VERSION
  45. The connection uses the TLSv1.1 protocol.
  46. =item TLS1_2_VERSION
  47. The connection uses the TLSv1.2 protocol.
  48. =item TLS1_3_VERSION
  49. The connection uses the TLSv1.3 protocol (never returned for
  50. SSL_client_version()).
  51. =back
  52. =head1 SEE ALSO
  53. L<ssl(7)>
  54. =head1 HISTORY
  55. The SSL_is_dtls() function was added in OpenSSL 1.1.0.
  56. =head1 COPYRIGHT
  57. Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
  58. Licensed under the Apache License 2.0 (the "License"). You may not use
  59. this file except in compliance with the License. You can obtain a copy
  60. in the file LICENSE in the source distribution or at
  61. L<https://www.openssl.org/source/license.html>.
  62. =cut