fix(ext/node): fix error type in DiffieHellman constructor (#29721)

This commit is contained in:
Yoshiya Hinosawa 2025-06-17 11:43:26 +09:00 committed by GitHub
parent e5b96243ac
commit b979c886e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View file

@ -117,7 +117,10 @@ export class DiffieHellmanImpl {
// The supplied parameter is our primeLength, generate a suitable prime.
this.#primeLength = sizeOrKey as number;
if (this.#primeLength < 2) {
throw new NodeError("ERR_OSSL_BN_BITS_TOO_SMALL", "bits too small");
throw new NodeError(
"ERR_OSSL_DH_MODULUS_TOO_SMALL",
"modulus too small",
);
}
this.#prime = Buffer.from(