| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ function toV(which, v, def) { | |||
| 47 | 47 | if (v === 'TLSv1') return TLS1_VERSION; | |
| 48 | 48 | if (v === 'TLSv1.1') return TLS1_1_VERSION; | |
| 49 | 49 | if (v === 'TLSv1.2') return TLS1_2_VERSION; | |
| 50 | - if (v === 'TLSv1.3') return TLS1_3_VERSION; | ||
| 50 | + if (v === 'TLSv1.3' && TLS1_3_VERSION) return TLS1_3_VERSION; | ||
| 51 | 51 | throw new ERR_TLS_INVALID_PROTOCOL_VERSION(v, which); | |
| 52 | 52 | } | |
| 53 | 53 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1245,7 +1245,9 @@ void DefineCryptoConstants(Local<Object> target) { | |||
| 1245 | 1245 | NODE_DEFINE_CONSTANT(target, TLS1_VERSION); | |
| 1246 | 1246 | NODE_DEFINE_CONSTANT(target, TLS1_1_VERSION); | |
| 1247 | 1247 | NODE_DEFINE_CONSTANT(target, TLS1_2_VERSION); | |
| 1248 | + #ifdef TLS1_3_VERSION | ||
| 1248 | 1249 | NODE_DEFINE_CONSTANT(target, TLS1_3_VERSION); | |
| 1250 | + #endif | ||
| 1249 | 1251 | #endif | |
| 1250 | 1252 | NODE_DEFINE_CONSTANT(target, INT_MAX); | |
| 1251 | 1253 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -411,7 +411,12 @@ void SecureContext::New(const FunctionCallbackInfo<Value>& args) { | |||
| 411 | 411 | ||
| 412 | 412 | // A maxVersion of 0 means "any", but OpenSSL may support TLS versions that | |
| 413 | 413 | // Node.js doesn't, so pin the max to what we do support. | |
| 414 | - const int MAX_SUPPORTED_VERSION = TLS1_3_VERSION; | ||
| 414 | + const int MAX_SUPPORTED_VERSION = | ||
| 415 | + #ifdef TLS1_3_VERSION | ||
| 416 | + TLS1_3_VERSION; | ||
| 417 | + #else | ||
| 418 | + TLS1_2_VERSION; | ||
| 419 | + #endif | ||
| 415 | 420 | ||
| 416 | 421 | void SecureContext::Init(const FunctionCallbackInfo<Value>& args) { | |
| 417 | 422 | SecureContext* sc; | |
@@ -947,7 +952,7 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) { | |||
| 947 | 952 | ||
| 948 | 953 | void SecureContext::SetCipherSuites(const FunctionCallbackInfo<Value>& args) { | |
| 949 | 954 | // BoringSSL doesn't allow API config of TLS1.3 cipher suites. | |
| 950 | - #ifndef OPENSSL_IS_BORINGSSL | ||
| 955 | + #if defined(TLS1_3_VERSION) && !defined(OPENSSL_IS_BORINGSSL) | ||
| 951 | 956 | SecureContext* sc; | |
| 952 | 957 | ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); | |
| 953 | 958 | Environment* env = sc->env(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,9 @@ | |||
| 4 | 4 | const common = require('../common'); | |
| 5 | 5 | const fixtures = require('../common/fixtures'); | |
| 6 | 6 | ||
| 7 | + if (!require('constants').TLS1_3_VERSION) | ||
| 8 | + common.skip(`openssl ${process.versions.openssl} does not support TLSv1.3`); | ||
| 9 | + | ||
| 7 | 10 | // Confirm that for TLSv1.3, renegotiate() is disallowed. | |
| 8 | 11 | ||
| 9 | 12 | const { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,6 +56,9 @@ server.listen(0, '127.0.0.1', common.mustCall(function() { | |||
| 56 | 56 | })); | |
| 57 | 57 | })); | |
| 58 | 58 | ||
| 59 | + if (!require('constants').TLS1_3_VERSION) | ||
| 60 | + return console.log('cannot test TLSv1.3 against 1.3-incapable shared lib'); | ||
| 61 | + | ||
| 59 | 62 | tls.createServer({ | |
| 60 | 63 | key: fixtures.readKey('agent2-key.pem'), | |
| 61 | 64 | cert: fixtures.readKey('agent2-cert.pem'), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,13 +9,25 @@ const { | |||
| 9 | 9 | } = require(fixtures.path('tls-connect')); | |
| 10 | 10 | const DEFAULT_MIN_VERSION = tls.DEFAULT_MIN_VERSION; | |
| 11 | 11 | const DEFAULT_MAX_VERSION = tls.DEFAULT_MAX_VERSION; | |
| 12 | + const tls13 = !!require('constants').TLS1_3_VERSION; | ||
| 13 | + | ||
| 14 | + if (!tls13 && ( | ||
| 15 | + DEFAULT_MAX_VERSION === 'TLSv1.3' || | ||
| 16 | + DEFAULT_MIN_VERSION === 'TLSv1.3')) { | ||
| 17 | + return common.skip('cannot test TLSv1.3 against 1.3-incapable shared lib'); | ||
| 18 | + } | ||
| 12 | 19 | ||
| 13 | 20 | function test(cmin, cmax, cprot, smin, smax, sprot, proto, cerr, serr) { | |
| 14 | 21 | assert(proto || cerr || serr, 'test missing any expectations'); | |
| 15 | 22 | // Report where test was called from. Strip leading garbage from | |
| 16 | 23 | // at Object.<anonymous> (file:line) | |
| 17 | 24 | // from the stack location, we only want the file:line part. | |
| 18 | 25 | const where = (new Error()).stack.split('\n')[2].replace(/[^(]*/, ''); | |
| 26 | + if (Array.prototype.includes.call(arguments, 'TLSv1.3')) { | ||
| 27 | + console.log('test: skip because TLSv1.3 is not supported'); | ||
| 28 | + console.log(' ', where); | ||
| 29 | + return; | ||
| 30 | + } | ||
| 19 | 31 | connect({ | |
| 20 | 32 | client: { | |
| 21 | 33 | checkServerIdentity: (servername, cert) => { }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,9 @@ const common = require('../common'); | |||
| 4 | 4 | if (!common.hasCrypto) | |
| 5 | 5 | common.skip('missing crypto'); | |
| 6 | 6 | ||
| 7 | + if (!require('constants').TLS1_3_VERSION) | ||
| 8 | + return common.skip('openssl before TLS1.3 does not check for failure'); | ||
| 9 | + | ||
| 7 | 10 | const assert = require('assert'); | |
| 8 | 11 | const tls = require('tls'); | |
| 9 | 12 | const fixtures = require('../common/fixtures'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,10 @@ if (tls13) | |||
| 15 | 15 | tls.DEFAULT_MAX_VERSION = 'TLSv1.3'; | |
| 16 | 16 | ||
| 17 | 17 | function test(cciphers, sciphers, cipher, cerr, serr) { | |
| 18 | + if (!tls13 && (/TLS_/.test(cciphers) || /TLS_/.test(sciphers))) { | ||
| 19 | + // Test relies on TLS1.3, skip it. | ||
| 20 | + return; | ||
| 21 | + } | ||
| 18 | 22 | assert(cipher || cerr || serr, 'test missing any expectations'); | |
| 19 | 23 | const where = (new Error()).stack.split('\n')[2].replace(/[^(]*/, ''); | |
| 20 | 24 | connect({ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments