@@ -6,6 +6,7 @@ if (!common.hasCrypto)
66
77const assert = require ( 'assert' ) ;
88const crypto = require ( 'crypto' ) ;
9+ const { hasOpenSSL } = require ( '../common/crypto' ) ;
910
1011function getOutcome ( fn ) {
1112 try {
@@ -78,7 +79,6 @@ function assertSameErrorOrSuccess(actual, expected) {
7879 saltLength : zero ,
7980 } ) ] ,
8081 [ 'dsa' , ( zero ) => ( { modulusLength : zero } ) ] ,
81- [ 'dsa' , ( zero ) => ( { modulusLength : 512 , divisorLength : zero } ) ] ,
8282 [ 'dh' , ( zero ) => ( { primeLength : zero } ) ] ,
8383 [ 'dh' , ( zero ) => ( { primeLength : 2 , generator : zero } ) ] ,
8484 ] ) {
@@ -88,6 +88,22 @@ function assertSameErrorOrSuccess(actual, expected) {
8888 ) ;
8989 }
9090
91+ if ( ! hasOpenSSL ( 3 ) && crypto . getFips ( ) ) {
92+ common . printSkipMessage (
93+ 'Skipping DSA divisorLength 0 key generation on OpenSSL 1.1.1' ) ;
94+ } else {
95+ assertSameErrorOrSuccess (
96+ getOutcome ( ( ) => crypto . generateKeyPairSync ( 'dsa' , {
97+ modulusLength : 512 ,
98+ divisorLength : - 0 ,
99+ } ) ) ,
100+ getOutcome ( ( ) => crypto . generateKeyPairSync ( 'dsa' , {
101+ modulusLength : 512 ,
102+ divisorLength : 0 ,
103+ } ) ) ,
104+ ) ;
105+ }
106+
91107 crypto . generateKeyPair ( 'rsa' , { modulusLength : - 0 } ,
92108 common . mustCall ( ( err ) => {
93109 assert ( err instanceof Error ) ;
0 commit comments