From 0f745bf9bde4e19dd352f10299d4365a4edaf386 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 12 Mar 2019 12:09:24 -0700 Subject: [PATCH] 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. PR-URL: https://github.com/nodejs/node/pull/26625 Reviewed-By: Daniel Bevenius Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Ruben Bridgewater Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- 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..fa34711fa81a12 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/man3/SSL_CIPHER_get_name.html) +for more information. ### tlsSocket.getEphemeralKeyInfo()