Skip to content

Commit 2efb16b

Browse files
davidbengibfahn
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 Backport-PR-URL: #18622 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent 5e9e4e5 commit 2efb16b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/node_crypto.cc

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

41254125
SignBase::Error SignBase::Init(const char* sign_type) {
41264126
CHECK_EQ(mdctx_, nullptr);
4127+
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
4128+
// Historically, "dss1" and "DSS1" were DSA aliases for SHA-1
4129+
// exposed through the public API.
4130+
if (strcmp(sign_type, "dss1") == 0 ||
4131+
strcmp(sign_type, "DSS1") == 0) {
4132+
sign_type = "SHA1";
4133+
}
4134+
#endif
41274135
const EVP_MD* md = EVP_get_digestbyname(sign_type);
41284136
if (md == nullptr)
41294137
return kSignUnknownDigest;

0 commit comments

Comments
 (0)