GeezerVison is showing github.com — tls: ciphers allow bang syntax · nodejs/node@52b5693
File treeExpand 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: lib/internal/tls/secure-context.js +8-4Lines changed: 8 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -101,17 +101,21 @@ function processCiphers(ciphers, name) { | 101 | 101 | ArrayPrototypeFilter( | 102 | 102 | ciphers, | 103 | 103 | (cipher) => { | 104 | | - return cipher.length > 0 && | 105 | | - !StringPrototypeStartsWith(cipher, 'TLS_'); | | 104 | + if (cipher.length === 0) return false; | | 105 | + if (StringPrototypeStartsWith(cipher, 'TLS_')) return false; | | 106 | + if (StringPrototypeStartsWith(cipher, '!TLS_')) return false; | | 107 | + return true; | 106 | 108 | }), ':'); | 107 | 109 |
| 108 | 110 | const cipherSuites = | 109 | 111 | ArrayPrototypeJoin( | 110 | 112 | ArrayPrototypeFilter( | 111 | 113 | ciphers, | 112 | 114 | (cipher) => { | 113 | | - return cipher.length > 0 && | 114 | | - StringPrototypeStartsWith(cipher, 'TLS_'); | | 115 | + if (cipher.length === 0) return false; | | 116 | + if (StringPrototypeStartsWith(cipher, 'TLS_')) return true; | | 117 | + if (StringPrototypeStartsWith(cipher, '!TLS_')) return true; | | 118 | + return false; | 115 | 119 | }), ':'); | 116 | 120 |
| 117 | 121 | // Specifying empty cipher suites for both TLS1.2 and TLS1.3 is invalid, its | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-tls-set-ciphers.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | const common = require('../common'); | 3 | | -if (!common.hasCrypto) | 4 | | - common.skip('missing crypto'); | | 3 | +if (!common.hasOpenSSL3) | | 4 | + common.skip('missing crypto, or OpenSSL version lower than 3'); | 5 | 5 |
| 6 | 6 | const fixtures = require('../common/fixtures'); | 7 | 7 | const { inspect } = require('util'); | @@ -85,6 +85,7 @@ test('AES256-SHA', U, 'AES256-SHA'); | 85 | 85 |
| 86 | 86 | test(U, 'TLS_AES_256_GCM_SHA384', 'TLS_AES_256_GCM_SHA384'); | 87 | 87 | test('TLS_AES_256_GCM_SHA384', U, 'TLS_AES_256_GCM_SHA384'); | | 88 | +test('TLS_AES_256_GCM_SHA384:!TLS_CHACHA20_POLY1305_SHA256', U, 'TLS_AES_256_GCM_SHA384'); | 88 | 89 |
| 89 | 90 | // Do not have shared ciphers. | 90 | 91 | test('TLS_AES_256_GCM_SHA384', 'TLS_CHACHA20_POLY1305_SHA256', | |
|