1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-09 15:41:10 +03:00

Remove HAVE_OPENSSL_EVP_DIGESTSIGN/VERIFY ifdefs

EVP_DigestSign and EVP_DigestVerify are implicitly included in new (>1.1.1)
openssl versions, no need to use the old functions.

Signed-off-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Norbert Pocs
2022-10-11 15:49:11 +02:00
committed by Jakub Jelen
parent 178d7934f9
commit 0c64a62fb7

View File

@@ -3075,7 +3075,6 @@ ssh_signature pki_sign_data(const ssh_key privkey,
goto out; goto out;
} }
#ifdef HAVE_OPENSSL_EVP_DIGESTSIGN
rc = EVP_DigestSign(ctx, raw_sig_data, &raw_sig_len, input, input_len); rc = EVP_DigestSign(ctx, raw_sig_data, &raw_sig_len, input, input_len);
if (rc != 1) { if (rc != 1) {
SSH_LOG(SSH_LOG_TRACE, SSH_LOG(SSH_LOG_TRACE,
@@ -3083,23 +3082,6 @@ ssh_signature pki_sign_data(const ssh_key privkey,
ERR_error_string(ERR_get_error(), NULL)); ERR_error_string(ERR_get_error(), NULL));
goto out; goto out;
} }
#else
rc = EVP_DigestSignUpdate(ctx, input, input_len);
if (rc != 1) {
SSH_LOG(SSH_LOG_TRACE,
"EVP_DigestSignUpdate() failed: %s",
ERR_error_string(ERR_get_error(), NULL));
goto out;
}
rc = EVP_DigestSignFinal(ctx, raw_sig_data, &raw_sig_len);
if (rc != 1) {
SSH_LOG(SSH_LOG_TRACE,
"EVP_DigestSignFinal() failed: %s",
ERR_error_string(ERR_get_error(), NULL));
goto out;
}
#endif
#ifdef DEBUG_CRYPTO #ifdef DEBUG_CRYPTO
ssh_log_hexdump("Generated signature", raw_sig_data, raw_sig_len); ssh_log_hexdump("Generated signature", raw_sig_data, raw_sig_len);
@@ -3236,19 +3218,7 @@ int pki_verify_data_signature(ssh_signature signature,
goto out; goto out;
} }
#ifdef HAVE_OPENSSL_EVP_DIGESTVERIFY
evp_rc = EVP_DigestVerify(ctx, raw_sig_data, raw_sig_len, input, input_len); evp_rc = EVP_DigestVerify(ctx, raw_sig_data, raw_sig_len, input, input_len);
#else
evp_rc = EVP_DigestVerifyUpdate(ctx, input, input_len);
if (evp_rc != 1) {
SSH_LOG(SSH_LOG_TRACE,
"EVP_DigestVerifyUpdate() failed: %s",
ERR_error_string(ERR_get_error(), NULL));
goto out;
}
evp_rc = EVP_DigestVerifyFinal(ctx, raw_sig_data, raw_sig_len);
#endif
if (evp_rc == 1) { if (evp_rc == 1) {
SSH_LOG(SSH_LOG_TRACE, "Signature valid"); SSH_LOG(SSH_LOG_TRACE, "Signature valid");
rc = SSH_OK; rc = SSH_OK;