Florian Festi a654ea
From 48546ffc0a3f3eb15bfd439a19fc9722eaea592f Mon Sep 17 00:00:00 2001
Florian Festi a654ea
From: Florian Festi <ffesti@redhat.com>
Florian Festi a654ea
Date: Tue, 28 Jun 2022 12:50:54 +0200
Florian Festi a654ea
Subject: [PATCH] Give warning on not supported hash for RSA keys
Florian Festi a654ea
Florian Festi a654ea
This can happen when old keys are used on systems that have disabled SHA1
Florian Festi a654ea
e.g. for FIPS requirements.
Florian Festi a654ea
Florian Festi a654ea
This is less than ideal but there is currently no way to pass a meaningful
Florian Festi a654ea
error code up to rpmtsImportPubkey. rpmPubkeyNew just returns a valid key
Florian Festi a654ea
or NULL.
Florian Festi a654ea
Florian Festi a654ea
See rhbz#2069877
Florian Festi a654ea
---
Florian Festi a654ea
 rpmio/digest_openssl.c | 2 ++
Florian Festi a654ea
 1 file changed, 2 insertions(+)
Florian Festi a654ea
Florian Festi a654ea
diff --git a/rpmio/digest_openssl.c b/rpmio/digest_openssl.c
Florian Festi a654ea
index a28a13acc..2ec5140f1 100644
Florian Festi a654ea
--- a/rpmio/digest_openssl.c
Florian Festi a654ea
+++ b/rpmio/digest_openssl.c
Florian Festi a654ea
@@ -4,6 +4,7 @@
Florian Festi a654ea
 #include <openssl/rsa.h>
Florian Festi a654ea
 #include <openssl/dsa.h>
Florian Festi a654ea
 #include <rpm/rpmpgp.h>
Florian Festi a654ea
+#include <rpm/rpmlog.h>
Florian Festi a654ea
 
Florian Festi a654ea
 #include "rpmio/digest.h"
Florian Festi a654ea
 
Florian Festi a654ea
@@ -483,6 +484,7 @@ static int pgpVerifySigRSA(pgpDigAlg pgpkey, pgpDigAlg pgpsig,
Florian Festi a654ea
 
Florian Festi a654ea
     ret = EVP_PKEY_CTX_set_signature_md(pkey_ctx, getEVPMD(hash_algo));
Florian Festi a654ea
     if (ret < 0) {
Florian Festi a654ea
+	rpmlog(RPMLOG_WARNING, "Signature not supported. Hash algorithm %s not available.\n", pgpValString(PGPVAL_HASHALGO, hash_algo));
Florian Festi a654ea
         rc = 1;
Florian Festi a654ea
         goto done;
Florian Festi a654ea
     }
Florian Festi a654ea
-- 
Florian Festi a654ea
2.36.1
Florian Festi a654ea