From 00cc39ec44b6598d4f9b63ab41686f8702b22489 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 8 Jan 2021 15:40:27 -0500 Subject: [PATCH] doc: update tls test to use better terminology MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Given the effort to change the master branch to main, this may make sense as part of removing other references to the offending wording as well. Signed-off-by: Michael Dawson PR-URL: https://github.com/nodejs/node/pull/36851 Reviewed-By: Gerhard Stöbich Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/common/tls.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/common/tls.js b/test/common/tls.js index e7cacde7456707..5094755c240afd 100644 --- a/test/common/tls.js +++ b/test/common/tls.js @@ -15,9 +15,9 @@ class TestTLSSocket extends net.Socket { this.handshake_list = []; // AES128-GCM-SHA256 this.ciphers = Buffer.from('000002009c0', 'hex'); - this.pre_master_secret = + this.pre_primary_secret = Buffer.concat([this.version, crypto.randomBytes(46)]); - this.master_secret = null; + this.primary_secret = null; this.write_seq = 0; this.client_random = crypto.randomBytes(32); @@ -26,12 +26,12 @@ class TestTLSSocket extends net.Socket { }); this.on('server_random', (server_random) => { - this.master_secret = PRF12('sha256', this.pre_master_secret, - 'master secret', - Buffer.concat([this.client_random, - server_random]), - 48); - const key_block = PRF12('sha256', this.master_secret, + this.primary_secret = PRF12('sha256', this.pre_primary_secret, + 'primary secret', + Buffer.concat([this.client_random, + server_random]), + 48); + const key_block = PRF12('sha256', this.primary_secret, 'key expansion', Buffer.concat([server_random, this.client_random]), @@ -51,14 +51,14 @@ class TestTLSSocket extends net.Socket { } createClientKeyExchange() { - const encrypted_pre_master_secret = crypto.publicEncrypt({ + const encrypted_pre_primary_secret = crypto.publicEncrypt({ key: this.server_cert, padding: crypto.constants.RSA_PKCS1_PADDING - }, this.pre_master_secret); + }, this.pre_primary_secret); const length = Buffer.alloc(2); - length.writeUIntBE(encrypted_pre_master_secret.length, 0, 2); + length.writeUIntBE(encrypted_pre_primary_secret.length, 0, 2); const msg = addHandshakeHeader(0x10, Buffer.concat([ - length, encrypted_pre_master_secret])); + length, encrypted_pre_primary_secret])); this.emit('handshake', msg); return addRecordHeader(0x16, msg); } @@ -67,7 +67,7 @@ class TestTLSSocket extends net.Socket { const shasum = crypto.createHash('sha256'); shasum.update(Buffer.concat(this.handshake_list)); const message_hash = shasum.digest(); - const r = PRF12('sha256', this.master_secret, + const r = PRF12('sha256', this.primary_secret, 'client finished', message_hash, 12); const msg = addHandshakeHeader(0x14, r); this.emit('handshake', msg);