From 666beb0421a10c6f062bff88828b9ccad7b3fceb Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 7 Feb 2019 13:27:14 -0800 Subject: tls: renegotiate should take care of its own state In the initial version of this test there were two zero-length writes to force tls state to cycle. The second is not necessary, at least not now, but the first was. The renegotiate() API should ensure that packet exchange takes place, not its users, so move the zero-length write into tls. See: https://github.com/nodejs/node/pull/14239 See: https://github.com/nodejs/node/commit/b1909d3a70f9 PR-URL: https://github.com/nodejs/node/pull/25997 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- lib/_tls_wrap.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 182dab7584..eaf937640e 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -621,6 +621,9 @@ TLSSocket.prototype.renegotiate = function(options, callback) { this._requestCert = requestCert; this._rejectUnauthorized = rejectUnauthorized; } + // Ensure that we'll cycle through internal openssl's state + this.write(''); + if (!this._handle.renegotiate()) { if (callback) { process.nextTick(callback, new ERR_TLS_RENEGOTIATE()); -- cgit v1.2.3