From c40ff55314238da77bbb141921d543cf4954b3f6 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 12 Mar 2019 12:09:24 -0700 Subject: [PATCH 1/2] tls: return correct version from getCipher() OpenSSL 1.0.0 returned incorrect version information. OpenSSL 1.1.0 fixed this, but returning the correct information broke our tests, so was considered semver-major. Because of this, the version was hard-coded to the OpenSSL 1.0.0 (incorrect) string in 5fe81c8aff03261. This is ancient history, start returning the correct cipher version. --- doc/api/tls.md | 17 ++++++++++---- lib/_tls_wrap.js | 16 ++++++------- src/node_crypto.cc | 7 +++--- src/node_crypto.h | 2 +- test/parallel/test-tls-getcipher.js | 36 ++++++++++++++++++++--------- test/parallel/test-tls-multi-key.js | 4 ++-- test/parallel/test-tls-multi-pfx.js | 4 ++-- 7 files changed, 54 insertions(+), 32 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index d4c635963b34e7..56e37bd78c51eb 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -717,18 +717,25 @@ socket has been destroyed, `null` will be returned. ### tlsSocket.getCipher() * Returns: {Object} + * `name` {string} The name of the cipher suite. + * `version` {string} The minimum TLS protocol version supported by this cipher + suite. -Returns an object representing the cipher name. The `version` key is a legacy -field which always contains the value `'TLSv1/SSLv3'`. +Returns an object containing information on the negotiated cipher suite. For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }`. -See `SSL_CIPHER_get_name()` in - for more -information. +See +[OpenSSL](https://www.openssl.org/docs/man1.1.1/ssl/SSL_CIPHER_get_name.html) +for more information. ### tlsSocket.getEphemeralKeyInfo()