@@ -6,10 +6,6 @@ if (!common.hasCrypto)
66const assert = require ( 'assert' ) ;
77const crypto = require ( 'crypto' ) ;
88
9- const DH_CHECK_P_NOT_PRIME = crypto . constants . DH_CHECK_P_NOT_PRIME ;
10- const DH_CHECK_P_NOT_SAFE_PRIME = crypto . constants . DH_CHECK_P_NOT_SAFE_PRIME ;
11- const DH_NOT_SUITABLE_GENERATOR = crypto . constants . DH_NOT_SUITABLE_GENERATOR ;
12-
139// Test Diffie-Hellman with two parties sharing a secret,
1410// using various encodings as we go along
1511const dh1 = crypto . createDiffieHellman ( common . hasFipsCrypto ? 1024 : 256 ) ;
@@ -128,8 +124,6 @@ bob.generateKeys();
128124const aSecret = alice . computeSecret ( bob . getPublicKey ( ) ) . toString ( 'hex' ) ;
129125const bSecret = bob . computeSecret ( alice . getPublicKey ( ) ) . toString ( 'hex' ) ;
130126assert . strictEqual ( aSecret , bSecret ) ;
131- assert . strictEqual ( alice . verifyError , 0 ) ;
132- assert . strictEqual ( bob . verifyError , 0 ) ;
133127
134128/* Ensure specific generator (buffer) works as expected.
135129 * The values below (modp2/modp2buf) are for a 1024 bits long prime from
@@ -160,8 +154,6 @@ const modp2buf = Buffer.from([
160154 const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
161155 . toString ( 'hex' ) ;
162156 assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
163- assert . strictEqual ( modp2 . verifyError , 0 ) ;
164- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
165157}
166158
167159for ( const buf of [ modp2buf , ...common . getArrayBufferViews ( modp2buf ) ] ) {
@@ -174,7 +166,6 @@ for (const buf of [modp2buf, ...common.getArrayBufferViews(modp2buf)]) {
174166 const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
175167 . toString ( 'hex' ) ;
176168 assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
177- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
178169}
179170
180171{
@@ -186,7 +177,6 @@ for (const buf of [modp2buf, ...common.getArrayBufferViews(modp2buf)]) {
186177 const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
187178 . toString ( 'hex' ) ;
188179 assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
189- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
190180}
191181
192182{
@@ -198,7 +188,6 @@ for (const buf of [modp2buf, ...common.getArrayBufferViews(modp2buf)]) {
198188 const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
199189 . toString ( 'hex' ) ;
200190 assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
201- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
202191}
203192
204193// Second OAKLEY group, see
@@ -208,13 +197,11 @@ const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' +
208197 '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' +
209198 '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' +
210199 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF' ;
211- const dh = crypto . createDiffieHellman ( p , 'hex' ) ;
212- assert . strictEqual ( dh . verifyError , 0 ) ;
200+ crypto . createDiffieHellman ( p , 'hex' ) ;
213201
214202// Confirm DH_check() results are exposed for optional examination.
215203const bad_dh = crypto . createDiffieHellman ( '02' , 'hex' ) ;
216- assert . strictEqual ( bad_dh . verifyError , DH_CHECK_P_NOT_PRIME |
217- DH_CHECK_P_NOT_SAFE_PRIME | DH_NOT_SUITABLE_GENERATOR ) ;
204+ assert . notStrictEqual ( bad_dh . verifyError , 0 ) ;
218205
219206const availableCurves = new Set ( crypto . getCurves ( ) ) ;
220207const availableHashes = new Set ( crypto . getHashes ( ) ) ;
0 commit comments