Skip to content

Commit c42935b

Browse files
davidbenevanlucas
authored andcommitted
crypto: add compat logic for "DSS1" and "dss1"
In OpenSSL 1.1.0, EVP_dss1() is removed. These hash names were exposed in Node's public API, so add compatibility hooks for them. PR-URL: #16130 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent 5c24fc3 commit c42935b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/node_crypto.cc

+8
Original file line numberDiff line numberDiff line change
@@ -4080,6 +4080,14 @@ SignBase::~SignBase() {
40804080

40814081
SignBase::Error SignBase::Init(const char* sign_type) {
40824082
CHECK_EQ(mdctx_, nullptr);
4083+
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
4084+
// Historically, "dss1" and "DSS1" were DSA aliases for SHA-1
4085+
// exposed through the public API.
4086+
if (strcmp(sign_type, "dss1") == 0 ||
4087+
strcmp(sign_type, "DSS1") == 0) {
4088+
sign_type = "SHA1";
4089+
}
4090+
#endif
40834091
const EVP_MD* md = EVP_get_digestbyname(sign_type);
40844092
if (md == nullptr)
40854093
return kSignUnknownDigest;

0 commit comments

Comments
 (0)