@@ -626,22 +626,27 @@ for (const test of TEST_CASES) {
626626
627627{
628628 // CCM cipher without data should not crash, see https://github.com/nodejs/node/issues/38035.
629- const algo = 'aes-128-ccm' ;
630- const key = Buffer . alloc ( 16 ) ;
631- const iv = Buffer . alloc ( 12 ) ;
632- const opts = { authTagLength : 10 } ;
629+ if ( ! ciphers . includes ( 'aes-128-ccm' ) ) {
630+ common . printSkipMessage ( `unsupported aes-128-ccm test` ) ;
631+ } else {
632+ const key = Buffer . alloc ( 16 ) ;
633+ const iv = Buffer . alloc ( 12 ) ;
634+ const opts = { authTagLength : 10 } ;
633635
634- const cipher = crypto . createCipheriv ( algo , key , iv , opts ) ;
635- assert . throws ( ( ) => {
636- cipher . final ( ) ;
637- } , hasOpenSSL3 ? {
638- code : 'ERR_OSSL_TAG_NOT_SET'
639- } : {
640- message : / U n s u p p o r t e d s t a t e /
641- } ) ;
636+ const cipher = crypto . createCipheriv ( 'aes-128-ccm' , key , iv , opts ) ;
637+ assert . throws ( ( ) => {
638+ cipher . final ( ) ;
639+ } , hasOpenSSL3 ? {
640+ code : 'ERR_OSSL_TAG_NOT_SET'
641+ } : {
642+ message : / U n s u p p o r t e d s t a t e /
643+ } ) ;
644+ }
642645}
643646
644- {
647+ if ( process . features . openssl_is_boringssl ) {
648+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
649+ } else {
645650 const key = Buffer . alloc ( 32 ) ;
646651 const iv = Buffer . alloc ( 12 ) ;
647652
@@ -657,13 +662,15 @@ for (const test of TEST_CASES) {
657662
658663// ChaCha20-Poly1305 should respect the authTagLength option and should not
659664// require the authentication tag before calls to update() during decryption.
660- {
665+ if ( process . features . openssl_is_boringssl ) {
666+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
667+ } else {
661668 const key = Buffer . alloc ( 32 ) ;
662669 const iv = Buffer . alloc ( 12 ) ;
663670
664671 for ( let authTagLength = 1 ; authTagLength <= 16 ; authTagLength ++ ) {
665672 const cipher =
666- crypto . createCipheriv ( 'chacha20-poly1305' , key , iv , { authTagLength } ) ;
673+ crypto . createCipheriv ( 'chacha20-poly1305' , key , iv , { authTagLength } ) ;
667674 const ciphertext = Buffer . concat ( [ cipher . update ( 'foo' ) , cipher . final ( ) ] ) ;
668675 const authTag = cipher . getAuthTag ( ) ;
669676 assert . strictEqual ( authTag . length , authTagLength ) ;
@@ -706,7 +713,9 @@ for (const test of TEST_CASES) {
706713// shorter tags as long as their length was valid according to NIST SP 800-38D.
707714// For ChaCha20-Poly1305, we intentionally deviate from that because there are
708715// no recommended or approved authentication tag lengths below 16 bytes.
709- {
716+ if ( process . features . openssl_is_boringssl ) {
717+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
718+ } else {
710719 const rfcTestCases = TEST_CASES . filter ( ( { algo, tampered } ) => {
711720 return algo === 'chacha20-poly1305' && tampered === false ;
712721 } ) ;
@@ -743,7 +752,9 @@ for (const test of TEST_CASES) {
743752}
744753
745754// https://github.com/nodejs/node/issues/45874
746- {
755+ if ( process . features . openssl_is_boringssl ) {
756+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
757+ } else {
747758 const rfcTestCases = TEST_CASES . filter ( ( { algo, tampered } ) => {
748759 return algo === 'chacha20-poly1305' && tampered === false ;
749760 } ) ;
0 commit comments