@@ -534,13 +534,8 @@ const expectedWarnings = common.hasFipsCrypto ?
534
534
[ 'Use Cipheriv for counter mode of aes-256-ccm' , common . noWarnCode ]
535
535
] ;
536
536
537
- const expectedDeprecationWarnings = [ 0 , 1 , 2 , 6 , 9 , 10 , 11 , 17 ]
538
- . map ( ( i ) => [ `Permitting authentication tag lengths of ${ i } bytes is ` +
539
- 'deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.' ,
540
- 'DEP0090' ] ) ;
541
-
542
- expectedDeprecationWarnings . push ( [ 'crypto.DEFAULT_ENCODING is deprecated.' ,
543
- 'DEP0091' ] ) ;
537
+ const expectedDeprecationWarnings = [ 'crypto.DEFAULT_ENCODING is deprecated.' ,
538
+ 'DEP0091' ] ;
544
539
545
540
common . expectWarning ( {
546
541
Warning : expectedWarnings ,
@@ -719,13 +714,18 @@ for (const test of TEST_CASES) {
719
714
}
720
715
721
716
// GCM only supports specific authentication tag lengths, invalid lengths should
722
- // produce warnings .
717
+ // throw .
723
718
{
724
- for ( const length of [ 0 , 1 , 2 , 4 , 6 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] ) {
725
- const decrypt = crypto . createDecipheriv ( 'aes-256-gcm' ,
726
- 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8' ,
727
- 'qkuZpJWCewa6Szih' ) ;
728
- decrypt . setAuthTag ( Buffer . from ( '1' . repeat ( length ) ) ) ;
719
+ for ( const length of [ 0 , 1 , 2 , 6 , 9 , 10 , 11 , 17 ] ) {
720
+ common . expectsError ( ( ) => {
721
+ const decrypt = crypto . createDecipheriv ( 'aes-128-gcm' ,
722
+ 'FxLKsqdmv0E9xrQh' ,
723
+ 'qkuZpJWCewa6Szih' ) ;
724
+ decrypt . setAuthTag ( Buffer . from ( '1' . repeat ( length ) ) ) ;
725
+ } , {
726
+ type : Error ,
727
+ message : `Invalid GCM authentication tag length: ${ length } `
728
+ } ) ;
729
729
}
730
730
}
731
731
0 commit comments