GeezerVison is showing github.com — tls: use SHA1 for sessionIdContext · nodejs/node@df268f9
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
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 number | Diff line number | Diff line change |
|---|
@@ -841,9 +841,9 @@ automatically set as a listener for the [secureConnection][] event. The |
841 | 841 | NOTE: Automatically shared between `cluster` module workers. |
842 | 842 |
|
843 | 843 | - `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. |
847 | 847 |
|
848 | 848 | - `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force |
849 | 849 | SSL version 3. The possible values depend on your installation of |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/_tls_wrap.js +4-16Lines changed: 4 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,21 +14,6 @@ const Timer = process.binding('timer_wrap').Timer; |
14 | 14 | const tls_wrap = process.binding('tls_wrap'); |
15 | 15 | const TCP = process.binding('tcp_wrap').TCP; |
16 | 16 | 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 | | -} |
32 | 17 |
|
33 | 18 | function onhandshakestart() { |
34 | 19 | debug('onhandshakestart'); |
@@ -908,7 +893,10 @@ Server.prototype.setOptions = function(options) { |
908 | 893 | if (options.sessionIdContext) { |
909 | 894 | this.sessionIdContext = options.sessionIdContext; |
910 | 895 | } else { |
911 | | - this.sessionIdContext = defaultSessionIdContext; |
| 896 | + this.sessionIdContext = crypto.createHash('sha1') |
| 897 | + .update(process.argv.join(' ')) |
| 898 | + .digest('hex') |
| 899 | + .slice(0, 32); |
912 | 900 | } |
913 | 901 | }; |
914 | 902 |
|
|