| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1f0a1d5 commit bfccc00
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1849,6 +1849,11 @@ vector for denial-of-service attacks. | |||
| 1849 | 1849 | An attempt was made to issue Server Name Indication from a TLS server-side | |
| 1850 | 1850 | socket, which is only valid from a client. | |
| 1851 | 1851 | ||
| 1852 | + <a id="ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED"></a> | ||
| 1853 | + ### ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED | ||
| 1854 | + | ||
| 1855 | + Failed to set PSK identity hint. Hint may be too long. | ||
| 1856 | + | ||
| 1852 | 1857 | <a id="ERR_TRACE_EVENTS_CATEGORY_REQUIRED"></a> | |
| 1853 | 1858 | ### `ERR_TRACE_EVENTS_CATEGORY_REQUIRED` | |
| 1854 | 1859 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,6 +118,40 @@ SNI (Server Name Indication) are TLS handshake extensions: | |||
| 118 | 118 | * SNI: Allows the use of one TLS server for multiple hostnames with different | |
| 119 | 119 | SSL certificates. | |
| 120 | 120 | ||
| 121 | + ### Pre-shared keys | ||
| 122 | + | ||
| 123 | + <!-- type=misc --> | ||
| 124 | + | ||
| 125 | + TLS-PSK support is available as an alternative to normal certificate-based | ||
| 126 | + authentication. It uses a pre-shared key instead of certificates to | ||
| 127 | + authenticate a TLS connection, providing mutual authentication. | ||
| 128 | + TLS-PSK and public key infrastructure are not mutually exclusive. Clients and | ||
| 129 | + servers can accommodate both, choosing either of them during the normal cipher | ||
| 130 | + negotiation step. | ||
| 131 | + | ||
| 132 | + TLS-PSK is only a good choice where means exist to securely share a | ||
| 133 | + key with every connecting machine, so it does not replace PKI | ||
| 134 | + (Public Key Infrastructure) for the majority of TLS uses. | ||
| 135 | + The TLS-PSK implementation in OpenSSL has seen many security flaws in | ||
| 136 | + recent years, mostly because it is used only by a minority of applications. | ||
| 137 | + Please consider all alternative solutions before switching to PSK ciphers. | ||
| 138 | + Upon generating PSK it is of critical importance to use sufficient entropy as | ||
| 139 | + discussed in [RFC 4086][]. Deriving a shared secret from a password or other | ||
| 140 | + low-entropy sources is not secure. | ||
| 141 | + | ||
| 142 | + PSK ciphers are disabled by default, and using TLS-PSK thus requires explicitly | ||
| 143 | + specifying a cipher suite with the `ciphers` option. The list of available | ||
| 144 | + ciphers can be retrieved via `openssl ciphers -v 'PSK'`. All TLS 1.3 | ||
| 145 | + ciphers are eligible for PSK but currently only those that use SHA256 digest are | ||
| 146 | + supported they can be retrieved via `openssl ciphers -v -s -tls1_3 -psk`. | ||
| 147 | + | ||
| 148 | + According to the [RFC 4279][], PSK identities up to 128 bytes in length and | ||
| 149 | + PSKs up to 64 bytes in length must be supported. As of OpenSSL 1.1.0 | ||
| 150 | + maximum identity size is 128 bytes, and maximum PSK length is 256 bytes. | ||
| 151 | + | ||
| 152 | + The current implementation doesn't support asynchronous PSK callbacks due to the | ||
| 153 | + limitations of the underlying OpenSSL API. | ||
| 154 | + | ||
| 121 | 155 | ### Client-initiated renegotiation attack mitigation | |
| 122 | 156 | ||
| 123 | 157 | <!-- type=misc --> | |
@@ -1207,6 +1241,9 @@ being issued by trusted CA (`options.ca`). | |||
| 1207 | 1241 | <!-- YAML | |
| 1208 | 1242 | added: v0.11.3 | |
| 1209 | 1243 | changes: | |
| 1244 | + - version: REPLACEME | ||
| 1245 | + pr-url: https://github.com/nodejs/node/pull/23188 | ||
| 1246 | + description: The `pskCallback` option is now supported. | ||
| 1210 | 1247 | - version: v12.9.0 | |
| 1211 | 1248 | pr-url: https://github.com/nodejs/node/pull/27836 | |
| 1212 | 1249 | description: Support the `allowHalfOpen` option. | |
@@ -1258,6 +1295,23 @@ changes: | |||
| 1258 | 1295 | verified against the list of supplied CAs. An `'error'` event is emitted if | |
| 1259 | 1296 | verification fails; `err.code` contains the OpenSSL error code. **Default:** | |
| 1260 | 1297 | `true`. | |
| 1298 | + * `pskCallback` {Function} | ||
| 1299 | + * hint: {string} optional message sent from the server to help client | ||
| 1300 | + decide which identity to use during negotiation. | ||
| 1301 | + Always `null` if TLS 1.3 is used. | ||
| 1302 | + * Returns: {Object} in the form | ||
| 1303 | + `{ psk: <Buffer|TypedArray|DataView>, identity: <string> }` | ||
| 1304 | + or `null` to stop the negotiation process. `psk` must be | ||
| 1305 | + compatible with the selected cipher's digest. | ||
| 1306 | + `identity` must use UTF-8 encoding. | ||
| 1307 | + When negotiating TLS-PSK (pre-shared keys), this function is called | ||
| 1308 | + with optional identity `hint` provided by the server or `null` | ||
| 1309 | + in case of TLS 1.3 where `hint` was removed. | ||
| 1310 | + It will be necessary to provide a custom `tls.checkServerIdentity()` | ||
| 1311 | + for the connection as the default one will try to check hostname/IP | ||
| 1312 | + of the server against the certificate but that's not applicable for PSK | ||
| 1313 | + because there won't be a certificate present. | ||
| 1314 | + More information can be found in the [RFC 4279][]. | ||
| 1261 | 1315 | * `ALPNProtocols`: {string[]|Buffer[]|TypedArray[]|DataView[]|Buffer| | |
| 1262 | 1316 | TypedArray|DataView} | |
| 1263 | 1317 | An array of strings, `Buffer`s or `TypedArray`s or `DataView`s, or a | |
@@ -1593,8 +1647,30 @@ changes: | |||
| 1593 | 1647 | provided the default callback with high-level API will be used (see below). | |
| 1594 | 1648 | * `ticketKeys`: {Buffer} 48-bytes of cryptographically strong pseudo-random | |
| 1595 | 1649 | data. See [Session Resumption][] for more information. | |
| 1650 | + * `pskCallback` {Function} | ||
| 1651 | + * socket: {tls.TLSSocket} the server [`tls.TLSSocket`][] instance for | ||
| 1652 | + this connection. | ||
| 1653 | + * identity: {string} identity parameter sent from the client. | ||
| 1654 | + * Returns: {Buffer|TypedArray|DataView} pre-shared key that must either be | ||
| 1655 | + a buffer or `null` to stop the negotiation process. Returned PSK must be | ||
| 1656 | + compatible with the selected cipher's digest. | ||
| 1657 | + When negotiating TLS-PSK (pre-shared keys), this function is called | ||
| 1658 | + with the identity provided by the client. | ||
| 1659 | + If the return value is `null` the negotiation process will stop and an | ||
| 1660 | + "unknown_psk_identity" alert message will be sent to the other party. | ||
| 1661 | + If the server wishes to hide the fact that the PSK identity was not known, | ||
| 1662 | + the callback must provide some random data as `psk` to make the connection | ||
| 1663 | + fail with "decrypt_error" before negotiation is finished. | ||
| 1664 | + PSK ciphers are disabled by default, and using TLS-PSK thus | ||
| 1665 | + requires explicitly specifying a cipher suite with the `ciphers` option. | ||
| 1666 | + More information can be found in the [RFC 4279][]. | ||
| 1667 | + * `pskIdentityHint` {string} optional hint to send to a client to help | ||
| 1668 | + with selecting the identity during TLS-PSK negotiation. Will be ignored | ||
| 1669 | + in TLS 1.3. Upon failing to set pskIdentityHint `'tlsClientError'` will be | ||
| 1670 | + emitted with `'ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED'` code. | ||
| 1596 | 1671 | * ...: Any [`tls.createSecureContext()`][] option can be provided. For | |
| 1597 | - servers, the identity options (`pfx` or `key`/`cert`) are usually required. | ||
| 1672 | + servers, the identity options (`pfx`, `key`/`cert` or `pskCallback`) | ||
| 1673 | + are usually required. | ||
| 1598 | 1674 | * ...: Any [`net.createServer()`][] option can be provided. | |
| 1599 | 1675 | * `secureConnectionListener` {Function} | |
| 1600 | 1676 | * Returns: {tls.Server} | |
@@ -1870,3 +1946,5 @@ where `secureSocket` has the same API as `pair.cleartext`. | |||
| 1870 | 1946 | [cipher list format]: https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT | |
| 1871 | 1947 | [modifying the default cipher suite]: #tls_modifying_the_default_tls_cipher_suite | |
| 1872 | 1948 | [specific attacks affecting larger AES key sizes]: https://www.schneier.com/blog/archives/2009/07/another_new_aes.html | |
| 1949 | + [RFC 4279]: https://tools.ietf.org/html/rfc4279 | ||
| 1950 | + [RFC 4086]: https://tools.ietf.org/html/rfc4086 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,10 +43,12 @@ const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap'); | |||
| 43 | 43 | const tls_wrap = internalBinding('tls_wrap'); | |
| 44 | 44 | const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); | |
| 45 | 45 | const { owner_symbol } = require('internal/async_hooks').symbols; | |
| 46 | + const { isArrayBufferView } = require('internal/util/types'); | ||
| 46 | 47 | const { SecureContext: NativeSecureContext } = internalBinding('crypto'); | |
| 47 | 48 | const { connResetException, codes } = require('internal/errors'); | |
| 48 | 49 | const { | |
| 49 | 50 | ERR_INVALID_ARG_TYPE, | |
| 51 | + ERR_INVALID_ARG_VALUE, | ||
| 50 | 52 | ERR_INVALID_CALLBACK, | |
| 51 | 53 | ERR_MULTIPLE_CALLBACK, | |
| 52 | 54 | ERR_SOCKET_CLOSED, | |
@@ -58,8 +60,9 @@ const { | |||
| 58 | 60 | ERR_TLS_SESSION_ATTACK, | |
| 59 | 61 | ERR_TLS_SNI_FROM_SERVER | |
| 60 | 62 | } = codes; | |
| 63 | + const { onpskexchange: kOnPskExchange } = internalBinding('symbols'); | ||
| 61 | 64 | const { getOptionValue } = require('internal/options'); | |
| 62 | - const { validateString } = require('internal/validators'); | ||
| 65 | + const { validateString, validateBuffer } = require('internal/validators'); | ||
| 63 | 66 | const traceTls = getOptionValue('--trace-tls'); | |
| 64 | 67 | const tlsKeylog = getOptionValue('--tls-keylog'); | |
| 65 | 68 | const { appendFile } = require('fs'); | |
@@ -70,6 +73,8 @@ const kHandshakeTimeout = Symbol('handshake-timeout'); | |||
| 70 | 73 | const kRes = Symbol('res'); | |
| 71 | 74 | const kSNICallback = Symbol('snicallback'); | |
| 72 | 75 | const kEnableTrace = Symbol('enableTrace'); | |
| 76 | + const kPskCallback = Symbol('pskcallback'); | ||
| 77 | + const kPskIdentityHint = Symbol('pskidentityhint'); | ||
| 73 | 78 | ||
| 74 | 79 | const noop = () => {}; | |
| 75 | 80 | ||
@@ -289,6 +294,67 @@ function onnewsession(sessionId, session) { | |||
| 289 | 294 | done(); | |
| 290 | 295 | } | |
| 291 | 296 | ||
| 297 | + function onPskServerCallback(identity, maxPskLen) { | ||
| 298 | + const owner = this[owner_symbol]; | ||
| 299 | + const ret = owner[kPskCallback](owner, identity); | ||
| 300 | + if (ret == null) | ||
| 301 | + return undefined; | ||
| 302 | + | ||
| 303 | + let psk; | ||
| 304 | + if (isArrayBufferView(ret)) { | ||
| 305 | + psk = ret; | ||
| 306 | + } else { | ||
| 307 | + if (typeof ret !== 'object') { | ||
| 308 | + throw new ERR_INVALID_ARG_TYPE( | ||
| 309 | + 'ret', | ||
| 310 | + ['Object', 'Buffer', 'TypedArray', 'DataView'], | ||
| 311 | + ret | ||
| 312 | + ); | ||
| 313 | + } | ||
| 314 | + psk = ret.psk; | ||
| 315 | + validateBuffer(psk, 'psk'); | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + if (psk.length > maxPskLen) { | ||
| 319 | + throw new ERR_INVALID_ARG_VALUE( | ||
| 320 | + 'psk', | ||
| 321 | + psk, | ||
| 322 | + `Pre-shared key exceeds ${maxPskLen} bytes` | ||
| 323 | + ); | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + return psk; | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + function onPskClientCallback(hint, maxPskLen, maxIdentityLen) { | ||
| 330 | + const owner = this[owner_symbol]; | ||
| 331 | + const ret = owner[kPskCallback](hint); | ||
| 332 | + if (ret == null) | ||
| 333 | + return undefined; | ||
| 334 | + | ||
| 335 | + if (typeof ret !== 'object') | ||
| 336 | + throw new ERR_INVALID_ARG_TYPE('ret', 'Object', ret); | ||
| 337 | + | ||
| 338 | + validateBuffer(ret.psk, 'psk'); | ||
| 339 | + if (ret.psk.length > maxPskLen) { | ||
| 340 | + throw new ERR_INVALID_ARG_VALUE( | ||
| 341 | + 'psk', | ||
| 342 | + ret.psk, | ||
| 343 | + `Pre-shared key exceeds ${maxPskLen} bytes` | ||
| 344 | + ); | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + validateString(ret.identity, 'identity'); | ||
| 348 | + if (Buffer.byteLength(ret.identity) > maxIdentityLen) { | ||
| 349 | + throw new ERR_INVALID_ARG_VALUE( | ||
| 350 | + 'identity', | ||
| 351 | + ret.identity, | ||
| 352 | + `PSK identity exceeds ${maxIdentityLen} bytes` | ||
| 353 | + ); | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + return { psk: ret.psk, identity: ret.identity }; | ||
| 357 | + } | ||
| 292 | 358 | ||
| 293 | 359 | function onkeylogclient(line) { | |
| 294 | 360 | debug('client onkeylog'); | |
@@ -687,6 +753,32 @@ TLSSocket.prototype._init = function(socket, wrap) { | |||
| 687 | 753 | ssl.setALPNProtocols(ssl._secureContext.alpnBuffer); | |
| 688 | 754 | } | |
| 689 | 755 | ||
| 756 | + if (options.pskCallback && ssl.enablePskCallback) { | ||
| 757 | + if (typeof options.pskCallback !== 'function') { | ||
| 758 | + throw new ERR_INVALID_ARG_TYPE('pskCallback', | ||
| 759 | + 'function', | ||
| 760 | + options.pskCallback); | ||
| 761 | + } | ||
| 762 | + | ||
| 763 | + ssl[kOnPskExchange] = options.isServer ? | ||
| 764 | + onPskServerCallback : onPskClientCallback; | ||
| 765 | + | ||
| 766 | + this[kPskCallback] = options.pskCallback; | ||
| 767 | + ssl.enablePskCallback(); | ||
| 768 | + | ||
| 769 | + if (options.pskIdentityHint) { | ||
| 770 | + if (typeof options.pskIdentityHint !== 'string') { | ||
| 771 | + throw new ERR_INVALID_ARG_TYPE( | ||
| 772 | + 'options.pskIdentityHint', | ||
| 773 | + 'string', | ||
| 774 | + options.pskIdentityHint | ||
| 775 | + ); | ||
| 776 | + } | ||
| 777 | + ssl.setPskIdentityHint(options.pskIdentityHint); | ||
| 778 | + } | ||
| 779 | + } | ||
| 780 | + | ||
| 781 | + | ||
| 690 | 782 | if (options.handshakeTimeout > 0) | |
| 691 | 783 | this.setTimeout(options.handshakeTimeout, this._handleTimeout); | |
| 692 | 784 | ||
@@ -898,7 +990,7 @@ function makeSocketMethodProxy(name) { | |||
| 898 | 990 | TLSSocket.prototype[method] = makeSocketMethodProxy(method); | |
| 899 | 991 | }); | |
| 900 | 992 | ||
| 901 | - // TODO: support anonymous (nocert) and PSK | ||
| 993 | + // TODO: support anonymous (nocert) | ||
| 902 | 994 | ||
| 903 | 995 | ||
| 904 | 996 | function onServerSocketSecure() { | |
@@ -954,6 +1046,8 @@ function tlsConnectionListener(rawSocket) { | |||
| 954 | 1046 | SNICallback: this[kSNICallback] || SNICallback, | |
| 955 | 1047 | enableTrace: this[kEnableTrace], | |
| 956 | 1048 | pauseOnConnect: this.pauseOnConnect, | |
| 1049 | + pskCallback: this[kPskCallback], | ||
| 1050 | + pskIdentityHint: this[kPskIdentityHint], | ||
| 957 | 1051 | }); | |
| 958 | 1052 | ||
| 959 | 1053 | socket.on('secure', onServerSocketSecure); | |
@@ -1058,6 +1152,8 @@ function Server(options, listener) { | |||
| 1058 | 1152 | ||
| 1059 | 1153 | this[kHandshakeTimeout] = options.handshakeTimeout || (120 * 1000); | |
| 1060 | 1154 | this[kSNICallback] = options.SNICallback; | |
| 1155 | + this[kPskCallback] = options.pskCallback; | ||
| 1156 | + this[kPskIdentityHint] = options.pskIdentityHint; | ||
| 1061 | 1157 | ||
| 1062 | 1158 | if (typeof this[kHandshakeTimeout] !== 'number') { | |
| 1063 | 1159 | throw new ERR_INVALID_ARG_TYPE( | |
@@ -1069,6 +1165,18 @@ function Server(options, listener) { | |||
| 1069 | 1165 | 'options.SNICallback', 'function', options.SNICallback); | |
| 1070 | 1166 | } | |
| 1071 | 1167 | ||
| 1168 | + if (this[kPskCallback] && typeof this[kPskCallback] !== 'function') { | ||
| 1169 | + throw new ERR_INVALID_ARG_TYPE( | ||
| 1170 | + 'options.pskCallback', 'function', options.pskCallback); | ||
| 1171 | + } | ||
| 1172 | + if (this[kPskIdentityHint] && typeof this[kPskIdentityHint] !== 'string') { | ||
| 1173 | + throw new ERR_INVALID_ARG_TYPE( | ||
| 1174 | + 'options.pskIdentityHint', | ||
| 1175 | + 'string', | ||
| 1176 | + options.pskIdentityHint | ||
| 1177 | + ); | ||
| 1178 | + } | ||
| 1179 | + | ||
| 1072 | 1180 | // constructor call | |
| 1073 | 1181 | net.Server.call(this, options, tlsConnectionListener); | |
| 1074 | 1182 | ||
@@ -1265,6 +1373,8 @@ Server.prototype.setOptions = deprecate(function(options) { | |||
| 1265 | 1373 | .digest('hex') | |
| 1266 | 1374 | .slice(0, 32); | |
| 1267 | 1375 | } | |
| 1376 | + if (options.pskCallback) this[kPskCallback] = options.pskCallback; | ||
| 1377 | + if (options.pskIdentityHint) this[kPskIdentityHint] = options.pskIdentityHint; | ||
| 1268 | 1378 | }, 'Server.prototype.setOptions() is deprecated', 'DEP0122'); | |
| 1269 | 1379 | ||
| 1270 | 1380 | // SNI Contexts High-Level API | |
@@ -1440,7 +1550,8 @@ exports.connect = function connect(...args) { | |||
| 1440 | 1550 | session: options.session, | |
| 1441 | 1551 | ALPNProtocols: options.ALPNProtocols, | |
| 1442 | 1552 | requestOCSP: options.requestOCSP, | |
| 1443 | - enableTrace: options.enableTrace | ||
| 1553 | + enableTrace: options.enableTrace, | ||
| 1554 | + pskCallback: options.pskCallback, | ||
| 1444 | 1555 | }); | |
| 1445 | 1556 | ||
| 1446 | 1557 | tlssock[kConnectOptions] = options; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,11 +160,12 @@ constexpr size_t kFsStatsBufferLength = | |||
| 160 | 160 | ||
| 161 | 161 | // Symbols are per-isolate primitives but Environment proxies them | |
| 162 | 162 | // for the sake of convenience. | |
| 163 | - #define PER_ISOLATE_SYMBOL_PROPERTIES(V) \ | ||
| 164 | - V(handle_onclose_symbol, "handle_onclose") \ | ||
| 165 | - V(no_message_symbol, "no_message_symbol") \ | ||
| 166 | - V(oninit_symbol, "oninit") \ | ||
| 167 | - V(owner_symbol, "owner") \ | ||
| 163 | + #define PER_ISOLATE_SYMBOL_PROPERTIES(V) \ | ||
| 164 | + V(handle_onclose_symbol, "handle_onclose") \ | ||
| 165 | + V(no_message_symbol, "no_message_symbol") \ | ||
| 166 | + V(oninit_symbol, "oninit") \ | ||
| 167 | + V(owner_symbol, "owner") \ | ||
| 168 | + V(onpskexchange_symbol, "onpskexchange") \ | ||
| 168 | 169 | ||
| 169 | 170 | // Strings are per-isolate primitives but Environment proxies them | |
| 170 | 171 | // for the sake of convenience. Strings should be ASCII-only. | |
@@ -254,6 +255,7 @@ constexpr size_t kFsStatsBufferLength = | |||
| 254 | 255 | V(host_string, "host") \ | |
| 255 | 256 | V(hostmaster_string, "hostmaster") \ | |
| 256 | 257 | V(http_1_1_string, "http/1.1") \ | |
| 258 | + V(identity_string, "identity") \ | ||
| 257 | 259 | V(ignore_string, "ignore") \ | |
| 258 | 260 | V(import_string, "import") \ | |
| 259 | 261 | V(infoaccess_string, "infoAccess") \ | |
@@ -325,6 +327,7 @@ constexpr size_t kFsStatsBufferLength = | |||
| 325 | 327 | V(priority_string, "priority") \ | |
| 326 | 328 | V(process_string, "process") \ | |
| 327 | 329 | V(promise_string, "promise") \ | |
| 330 | + V(psk_string, "psk") \ | ||
| 328 | 331 | V(pubkey_string, "pubkey") \ | |
| 329 | 332 | V(query_string, "query") \ | |
| 330 | 333 | V(raw_string, "raw") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2620,6 +2620,16 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) { | |||
| 2620 | 2620 | if (X509* peer_cert = SSL_get_peer_certificate(w->ssl_.get())) { | |
| 2621 | 2621 | X509_free(peer_cert); | |
| 2622 | 2622 | x509_verify_error = SSL_get_verify_result(w->ssl_.get()); | |
| 2623 | + } else { | ||
| 2624 | + const SSL_CIPHER* curr_cipher = SSL_get_current_cipher(w->ssl_.get()); | ||
| 2625 | + const SSL_SESSION* sess = SSL_get_session(w->ssl_.get()); | ||
| 2626 | + // Allow no-cert for PSK authentication in TLS1.2 and lower. | ||
| 2627 | + // In TLS1.3 check that session was reused because TLS1.3 PSK | ||
| 2628 | + // looks like session resumption. Is there a better way? | ||
| 2629 | + if (SSL_CIPHER_get_auth_nid(curr_cipher) == NID_auth_psk || | ||
| 2630 | + (SSL_SESSION_get_protocol_version(sess) == TLS1_3_VERSION && | ||
| 2631 | + SSL_session_reused(w->ssl_.get()))) | ||
| 2632 | + return args.GetReturnValue().SetNull(); | ||
| 2623 | 2633 | } | |
| 2624 | 2634 | ||
| 2625 | 2635 | if (x509_verify_error == X509_V_OK) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,6 +58,7 @@ void PrintErrorString(const char* format, ...); | |||
| 58 | 58 | V(ERR_STRING_TOO_LONG, Error) \ | |
| 59 | 59 | V(ERR_TLS_INVALID_PROTOCOL_METHOD, TypeError) \ | |
| 60 | 60 | V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, TypeError) \ | |
| 61 | + V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \ | ||
| 61 | 62 | ||
| 62 | 63 | #define V(code, type) \ | |
| 63 | 64 | inline v8::Local<v8::Value> code(v8::Isolate* isolate, \ | |
@@ -101,6 +102,7 @@ void PrintErrorString(const char* format, ...); | |||
| 101 | 102 | "Script execution was interrupted by `SIGINT`") \ | |
| 102 | 103 | V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, \ | |
| 103 | 104 | "Cannot serialize externalized SharedArrayBuffer") \ | |
| 105 | + V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \ | ||
| 104 | 106 | ||
| 105 | 107 | #define V(code, message) \ | |
| 106 | 108 | inline v8::Local<v8::Value> code(v8::Isolate* isolate) { \ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments