a8c6008
From: "Daniel P. Berrange" <berrange@redhat.com>
a8c6008
Date: Tue, 29 Aug 2017 17:03:30 +0100
a8c6008
Subject: [PATCH] crypto: fix test cert generation to not use SHA1 algorithm
a8c6008
a8c6008
GNUTLS 3.6.0 marked SHA1 as untrusted for certificates.
a8c6008
Unfortunately the gnutls_x509_crt_sign() method we are
a8c6008
using to create certificates in the test suite is fixed
a8c6008
to always use SHA1. We must switch to a different method
a8c6008
and explicitly ask for SHA256.
a8c6008
a8c6008
Reviewed-by: Eric Blake <eblake@redhat.com>
a8c6008
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
a8c6008
---
a8c6008
 tests/crypto-tls-x509-helpers.c | 3 ++-
a8c6008
 1 file changed, 2 insertions(+), 1 deletion(-)
a8c6008
a8c6008
diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helpers.c
a8c6008
index 64073d3bd3..173d4e28fb 100644
a8c6008
--- a/tests/crypto-tls-x509-helpers.c
a8c6008
+++ b/tests/crypto-tls-x509-helpers.c
a8c6008
@@ -406,7 +406,8 @@ test_tls_generate_cert(QCryptoTLSTestCertReq *req,
a8c6008
      * If no 'ca' is set then we are self signing
a8c6008
      * the cert. This is done for the root CA certs
a8c6008
      */
a8c6008
-    err = gnutls_x509_crt_sign(crt, ca ? ca : crt, privkey);
a8c6008
+    err = gnutls_x509_crt_sign2(crt, ca ? ca : crt, privkey,
a8c6008
+                                GNUTLS_DIG_SHA256, 0);
a8c6008
     if (err < 0) {
a8c6008
         g_critical("Failed to sign certificate %s",
a8c6008
                    gnutls_strerror(err));