Blame SOURCES/0001-FAPI-Fix-reading-of-the-root-certificate-for-provisi.patch

a56c8e
From c14bd543879f2336e57aa2dff0b437407d858272 Mon Sep 17 00:00:00 2001
a56c8e
From: Juergen Repp <juergen.repp@sit.fraunhofer.de>
a56c8e
Date: Fri, 19 Feb 2021 14:32:45 +0100
a56c8e
Subject: FAPI: Fix reading of the root certificate for
a56c8e
 provisioning.
a56c8e
MIME-Version: 1.0
a56c8e
Content-Type: text/plain; charset=UTF-8
a56c8e
Content-Transfer-Encoding: 8bit
a56c8e
a56c8e
* The root certificate defined by the environment variable FAPI_TEST_ROOT_CERT will
a56c8e
  only be used if it's allowed to use self generated root certificate with
a56c8e
  ./configure  --enable-self-generated-certificate
a56c8e
a56c8e
* This option is added to all integration tests which are using the TPM simulator.
a56c8e
a56c8e
 - Compared to the upstream commit 199b4edc the changes to CI config files
a56c8e
   are omitted.
a56c8e
a56c8e
Signed-off-by: Juergen Repp <juergen.repp@sit.fraunhofer.de>
a56c8e
---
a56c8e
 configure.ac                       | 8 ++++++++
a56c8e
 src/tss2-fapi/api/Fapi_Provision.c | 4 ++++
a56c8e
 2 files changed, 12 insertions(+)
a56c8e
a56c8e
diff --git a/configure.ac b/configure.ac
a56c8e
index f4df879c..d3bbb93d 100755
a56c8e
--- a/configure.ac
a56c8e
+++ b/configure.ac
a56c8e
@@ -440,6 +440,14 @@ AC_ARG_ENABLE([weakcrypto],
a56c8e
 AS_IF([test "x$enable_weakcrypto" = "xyes"],
a56c8e
 	AC_DEFINE([DISABLE_WEAK_CRYPTO],[1],[DISABLE WEAK CRYPTO ALGORITHMS]))
a56c8e
 
a56c8e
+AC_ARG_ENABLE([self-generated-certificate],
a56c8e
+            [AS_HELP_STRING([--enable-self-generated-certificate],
a56c8e
+                            [Alllow usage of self generated root certifcate])],,
a56c8e
+            [enable_self_generated_certificate=no])
a56c8e
+AS_IF([test "x$enable_self_generated_certificate" == xyes],
a56c8e
+	[AC_DEFINE([SELF_GENERATED_CERTIFICATE],[1], [Allow usage of self generated root certifcate])])
a56c8e
+
a56c8e
+
a56c8e
 AC_SUBST([PATH])
a56c8e
 
a56c8e
 dnl --------- Doxy Gen -----------------------
a56c8e
diff --git a/src/tss2-fapi/api/Fapi_Provision.c b/src/tss2-fapi/api/Fapi_Provision.c
a56c8e
index 00534a2e..9cf804ad 100644
a56c8e
--- a/src/tss2-fapi/api/Fapi_Provision.c
a56c8e
+++ b/src/tss2-fapi/api/Fapi_Provision.c
a56c8e
@@ -797,7 +797,11 @@ Fapi_Provision_Finish(FAPI_CONTEXT *context)
a56c8e
 
a56c8e
         statecase(context->state, PROVISION_PREPARE_READ_ROOT_CERT);
a56c8e
             /* Prepare reading of root certificate. */
a56c8e
+            root_ca_file = NULL;
a56c8e
+#ifdef SELF_GENERATED_CERTIFICATE
a56c8e
+#pragma message ( "*** Allow self generated certifcate ***" )
a56c8e
             root_ca_file = getenv("FAPI_TEST_ROOT_CERT");
a56c8e
+#endif
a56c8e
             if (!root_ca_file) {
a56c8e
                 context->state = PROVISION_EK_CHECK_CERT;
a56c8e
                 return TSS2_FAPI_RC_TRY_AGAIN;
a56c8e
-- 
a56c8e
2.26.3