@@ -6,10 +6,6 @@ if (!common.hasCrypto)
6
6
const assert = require ( 'assert' ) ;
7
7
const crypto = require ( 'crypto' ) ;
8
8
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
-
13
9
// Test Diffie-Hellman with two parties sharing a secret,
14
10
// using various encodings as we go along
15
11
const dh1 = crypto . createDiffieHellman ( common . hasFipsCrypto ? 1024 : 256 ) ;
@@ -128,8 +124,6 @@ bob.generateKeys();
128
124
const aSecret = alice . computeSecret ( bob . getPublicKey ( ) ) . toString ( 'hex' ) ;
129
125
const bSecret = bob . computeSecret ( alice . getPublicKey ( ) ) . toString ( 'hex' ) ;
130
126
assert . strictEqual ( aSecret , bSecret ) ;
131
- assert . strictEqual ( alice . verifyError , 0 ) ;
132
- assert . strictEqual ( bob . verifyError , 0 ) ;
133
127
134
128
/* Ensure specific generator (buffer) works as expected.
135
129
* The values below (modp2/modp2buf) are for a 1024 bits long prime from
@@ -160,8 +154,6 @@ const modp2buf = Buffer.from([
160
154
const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
161
155
. toString ( 'hex' ) ;
162
156
assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
163
- assert . strictEqual ( modp2 . verifyError , 0 ) ;
164
- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
165
157
}
166
158
167
159
for ( const buf of [ modp2buf , ...common . getArrayBufferViews ( modp2buf ) ] ) {
@@ -174,7 +166,6 @@ for (const buf of [modp2buf, ...common.getArrayBufferViews(modp2buf)]) {
174
166
const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
175
167
. toString ( 'hex' ) ;
176
168
assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
177
- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
178
169
}
179
170
180
171
{
@@ -186,7 +177,6 @@ for (const buf of [modp2buf, ...common.getArrayBufferViews(modp2buf)]) {
186
177
const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
187
178
. toString ( 'hex' ) ;
188
179
assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
189
- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
190
180
}
191
181
192
182
{
@@ -198,7 +188,6 @@ for (const buf of [modp2buf, ...common.getArrayBufferViews(modp2buf)]) {
198
188
const exmodp2Secret = exmodp2 . computeSecret ( modp2 . getPublicKey ( ) )
199
189
. toString ( 'hex' ) ;
200
190
assert . strictEqual ( modp2Secret , exmodp2Secret ) ;
201
- assert . strictEqual ( exmodp2 . verifyError , 0 ) ;
202
191
}
203
192
204
193
// Second OAKLEY group, see
@@ -208,13 +197,11 @@ const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' +
208
197
'020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' +
209
198
'4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' +
210
199
'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF' ;
211
- const dh = crypto . createDiffieHellman ( p , 'hex' ) ;
212
- assert . strictEqual ( dh . verifyError , 0 ) ;
200
+ crypto . createDiffieHellman ( p , 'hex' ) ;
213
201
214
202
// Confirm DH_check() results are exposed for optional examination.
215
203
const 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 ) ;
218
205
219
206
const availableCurves = new Set ( crypto . getCurves ( ) ) ;
220
207
const availableHashes = new Set ( crypto . getHashes ( ) ) ;
0 commit comments