Skip to content

Commit 594ef76

Browse files
davidbenrvagg
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: nodejs#16130 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent f7520ff commit 594ef76

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/node_crypto.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4049,6 +4049,14 @@ SignBase::~SignBase() {
40494049

40504050
SignBase::Error SignBase::Init(const char* sign_type) {
40514051
CHECK_EQ(mdctx_, nullptr);
4052+
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
4053+
// Historically, "dss1" and "DSS1" were DSA aliases for SHA-1
4054+
// exposed through the public API.
4055+
if (strcmp(sign_type, "dss1") == 0 ||
4056+
strcmp(sign_type, "DSS1") == 0) {
4057+
sign_type = "SHA1";
4058+
}
4059+
#endif
40524060
const EVP_MD* md = EVP_get_digestbyname(sign_type);
40534061
if (md == nullptr)
40544062
return kSignUnknownDigest;

0 commit comments

Comments
 (0)