Skip to content

Commit

Permalink
doc: update tls test to use better terminology
Browse files Browse the repository at this point in the history
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 <[email protected]>

PR-URL: #36851
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
mhdawson authored and ruyadorno committed Jan 21, 2021
1 parent b7d8e61 commit e73b107
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/common/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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]),
Expand All @@ -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);
}
Expand All @@ -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);
Expand Down

0 comments on commit e73b107

Please sign in to comment.