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

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