diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index abbe1abe7e53d7..3b738b7f47ec59 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -85,11 +85,15 @@ const crypto = require('crypto'); }, wrongBlockLength); } - assert.throws(() => { - dh3.computeSecret(''); - }, { message: common.hasOpenSSL3 ? - 'error:02800080:Diffie-Hellman routines::invalid secret' : - 'Supplied key is too small' }); + { + const v = crypto.constants.OPENSSL_VERSION_NUMBER; + const hasOpenSSL3WithNewErrorMessage = (v >= 0x300000c0 && v <= 0x30100000) || (v >= 0x30100040 && v <= 0x30200000); + assert.throws(() => { + dh3.computeSecret(''); + }, { message: common.hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ? + 'error:02800080:Diffie-Hellman routines::invalid secret' : + 'Supplied key is too small' }); + } } // Through a fluke of history, g=0 defaults to DH_GENERATOR (2).