GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tls: use SHA1 for sessionIdContext · nodejs/node@df268f9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • tls.markdown
  • lib
    • _tls_wrap.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/tls.markdown‎

Copy file name to clipboardExpand all lines: doc/api/tls.markdown
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,9 @@ automatically set as a listener for the [secureConnection][] event. The
841841
NOTE: Automatically shared between `cluster` module workers.
842842

843843
- `sessionIdContext`: A string containing an opaque identifier for session
844-
resumption. If `requestCert` is `true`, the default is MD5 hash value
845-
generated from command-line. (In FIPS mode a truncated SHA1 hash is
846-
used instead.) Otherwise, the default is not provided.
844+
resumption. If `requestCert` is `true`, the default is a 128 bit
845+
truncated SHA1 hash value generated from command-line. Otherwise,
846+
the default is not provided.
847847

848848
- `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force
849849
SSL version 3. The possible values depend on your installation of
Collapse file

‎lib/_tls_wrap.js‎

Copy file name to clipboardExpand all lines: lib/_tls_wrap.js
+4-16Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@ const Timer = process.binding('timer_wrap').Timer;
1414
const tls_wrap = process.binding('tls_wrap');
1515
const TCP = process.binding('tcp_wrap').TCP;
1616
const Pipe = process.binding('pipe_wrap').Pipe;
17-
const defaultSessionIdContext = getDefaultSessionIdContext();
18-
19-
function getDefaultSessionIdContext() {
20-
var defaultText = process.argv.join(' ');
21-
/* SSL_MAX_SID_CTX_LENGTH is 128 bits */
22-
if (process.config.variables.openssl_fips) {
23-
return crypto.createHash('sha1')
24-
.update(defaultText)
25-
.digest('hex').slice(0, 32);
26-
} else {
27-
return crypto.createHash('md5')
28-
.update(defaultText)
29-
.digest('hex');
30-
}
31-
}
3217

3318
function onhandshakestart() {
3419
debug('onhandshakestart');
@@ -908,7 +893,10 @@ Server.prototype.setOptions = function(options) {
908893
if (options.sessionIdContext) {
909894
this.sessionIdContext = options.sessionIdContext;
910895
} else {
911-
this.sessionIdContext = defaultSessionIdContext;
896+
this.sessionIdContext = crypto.createHash('sha1')
897+
.update(process.argv.join(' '))
898+
.digest('hex')
899+
.slice(0, 32);
912900
}
913901
};
914902

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.