Blame 0001-gnutls-Prevent-cycles-when-building-the-certificate-.patch

Michael Catanzaro f102eb9
From 7db4dbf03b21e382622d452afda5e28db31d0185 Mon Sep 17 00:00:00 2001
Michael Catanzaro f102eb9
From: Carlos Garcia Campos <cgarcia@igalia.com>
Michael Catanzaro f102eb9
Date: Thu, 21 Apr 2016 12:28:05 +0200
Michael Catanzaro f102eb9
Subject: [PATCH] gnutls: Prevent cycles when building the certificate chain
Michael Catanzaro f102eb9
Michael Catanzaro f102eb9
Explicitly check self-signed certificates and leave a NULL issuer in that
Michael Catanzaro f102eb9
case.
Michael Catanzaro f102eb9
Michael Catanzaro f102eb9
https://bugzilla.gnome.org/show_bug.cgi?id=765317
Michael Catanzaro f102eb9
---
Michael Catanzaro f102eb9
 tls/gnutls/gtlscertificate-gnutls.c | 4 ++++
Michael Catanzaro f102eb9
 1 file changed, 4 insertions(+)
Michael Catanzaro f102eb9
Michael Catanzaro f102eb9
diff --git a/tls/gnutls/gtlscertificate-gnutls.c b/tls/gnutls/gtlscertificate-gnutls.c
Michael Catanzaro f102eb9
index 4ff996c..8dd0544 100644
Michael Catanzaro f102eb9
--- a/tls/gnutls/gtlscertificate-gnutls.c
Michael Catanzaro f102eb9
+++ b/tls/gnutls/gtlscertificate-gnutls.c
Michael Catanzaro f102eb9
@@ -722,6 +722,10 @@ g_tls_certificate_gnutls_build_chain (const gnutls_datum_t  *certs,
Michael Catanzaro f102eb9
     {
Michael Catanzaro f102eb9
       issuer = NULL;
Michael Catanzaro f102eb9
 
Michael Catanzaro f102eb9
+      /* Check if the cert issued itself */
Michael Catanzaro f102eb9
+      if (gnutls_x509_crt_check_issuer (gnutls_certs[i], gnutls_certs[i]))
Michael Catanzaro f102eb9
+        continue;
Michael Catanzaro f102eb9
+
Michael Catanzaro f102eb9
       if (i < num_certs - 1 &&
Michael Catanzaro f102eb9
           gnutls_x509_crt_check_issuer (gnutls_certs[i], gnutls_certs[i + 1]))
Michael Catanzaro f102eb9
         {
Michael Catanzaro f102eb9
-- 
Michael Catanzaro f102eb9
2.5.5
Michael Catanzaro f102eb9