@@ -626,22 +626,25 @@ 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 ) {
645648 const key = Buffer . alloc ( 32 ) ;
646649 const iv = Buffer . alloc ( 12 ) ;
647650
@@ -653,11 +656,13 @@ for (const test of TEST_CASES) {
653656 message : errMessages . authTagLength
654657 } ) ;
655658 }
659+ } else {
660+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
656661}
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 ) {
661666 const key = Buffer . alloc ( 32 ) ;
662667 const iv = Buffer . alloc ( 12 ) ;
663668
@@ -697,6 +702,8 @@ for (const test of TEST_CASES) {
697702 }
698703 }
699704 }
705+ } else {
706+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
700707}
701708
702709// ChaCha20-Poly1305 should default to an authTagLength of 16. When encrypting,
@@ -706,7 +713,7 @@ 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 ) {
710717 const rfcTestCases = TEST_CASES . filter ( ( { algo, tampered } ) => {
711718 return algo === 'chacha20-poly1305' && tampered === false ;
712719 } ) ;
@@ -740,10 +747,12 @@ for (const test of TEST_CASES) {
740747
741748 assert . strictEqual ( plaintext . toString ( 'hex' ) , testCase . plain ) ;
742749 }
750+ } else {
751+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
743752}
744753
745754// https://github.com/nodejs/node/issues/45874
746- {
755+ if ( ! process . features . openssl_is_boringssl ) {
747756 const rfcTestCases = TEST_CASES . filter ( ( { algo, tampered } ) => {
748757 return algo === 'chacha20-poly1305' && tampered === false ;
749758 } ) ;
@@ -771,4 +780,6 @@ for (const test of TEST_CASES) {
771780 assert . throws ( ( ) => {
772781 decipher . final ( ) ;
773782 } , / U n s u p p o r t e d s t a t e o r u n a b l e t o a u t h e n t i c a t e d a t a / ) ;
783+ } else {
784+ common . printSkipMessage ( 'Skipping unsupported chacha20-poly1305 test' ) ;
774785}
0 commit comments