|
|
00e791 |
From 7a3638173e406ce7cbd682213606e3152244fcb2 Mon Sep 17 00:00:00 2001
|
|
|
00e791 |
From: Gary Lin <glin@suse.com>
|
|
|
00e791 |
Date: Wed, 19 Dec 2018 11:27:42 +0800
|
|
|
00e791 |
Subject: [PATCH 23/62] shim: only include shim_cert.h in shim.c
|
|
|
00e791 |
|
|
|
00e791 |
The shim_cert array was declared as a static array, and every user of
|
|
|
00e791 |
shim_cert.h would create a shim_cert array for its own and grow the file
|
|
|
00e791 |
size. To remove the unnecessary duplicate shim_cert arrays, this commit
|
|
|
00e791 |
declares shim_cert in shim.c while other users still can access the
|
|
|
00e791 |
array through the external variables: build_cert and build_cert_size.
|
|
|
00e791 |
|
|
|
00e791 |
Signed-off-by: Gary Lin <glin@suse.com>
|
|
|
00e791 |
Upstream-commit-id: 4e2d62f0f4e
|
|
|
00e791 |
---
|
|
|
00e791 |
shim.c | 11 +++++++++++
|
|
|
00e791 |
shim.h | 7 ++++---
|
|
|
00e791 |
2 files changed, 15 insertions(+), 3 deletions(-)
|
|
|
00e791 |
|
|
|
00e791 |
diff --git a/shim.c b/shim.c
|
|
|
00e791 |
index e4d4fea226d..0a95f94b360 100644
|
|
|
00e791 |
--- a/shim.c
|
|
|
00e791 |
+++ b/shim.c
|
|
|
00e791 |
@@ -34,6 +34,9 @@
|
|
|
00e791 |
*/
|
|
|
00e791 |
|
|
|
00e791 |
#include "shim.h"
|
|
|
00e791 |
+#if defined(ENABLE_SHIM_CERT)
|
|
|
00e791 |
+#include "shim_cert.h"
|
|
|
00e791 |
+#endif /* defined(ENABLE_SHIM_CERT) */
|
|
|
00e791 |
|
|
|
00e791 |
#include <openssl/err.h>
|
|
|
00e791 |
#include <openssl/bn.h>
|
|
|
00e791 |
@@ -75,6 +78,10 @@ UINT32 vendor_cert_size;
|
|
|
00e791 |
UINT32 vendor_dbx_size;
|
|
|
00e791 |
UINT8 *vendor_cert;
|
|
|
00e791 |
UINT8 *vendor_dbx;
|
|
|
00e791 |
+#if defined(ENABLE_SHIM_CERT)
|
|
|
00e791 |
+UINT32 build_cert_size;
|
|
|
00e791 |
+UINT8 *build_cert;
|
|
|
00e791 |
+#endif /* defined(ENABLE_SHIM_CERT) */
|
|
|
00e791 |
|
|
|
00e791 |
/*
|
|
|
00e791 |
* indicator of how an image has been verified
|
|
|
00e791 |
@@ -2562,6 +2569,10 @@ efi_main (EFI_HANDLE passed_image_handle, EFI_SYSTEM_TABLE *passed_systab)
|
|
|
00e791 |
vendor_dbx_size = cert_table.vendor_dbx_size;
|
|
|
00e791 |
vendor_cert = (UINT8 *)&cert_table + cert_table.vendor_cert_offset;
|
|
|
00e791 |
vendor_dbx = (UINT8 *)&cert_table + cert_table.vendor_dbx_offset;
|
|
|
00e791 |
+#if defined(ENABLE_SHIM_CERT)
|
|
|
00e791 |
+ build_cert_size = sizeof(shim_cert);
|
|
|
00e791 |
+ build_cert = shim_cert;
|
|
|
00e791 |
+#endif /* defined(ENABLE_SHIM_CERT) */
|
|
|
00e791 |
CHAR16 *msgs[] = {
|
|
|
00e791 |
L"import_mok_state() failed\n",
|
|
|
00e791 |
L"shim_int() failed\n",
|
|
|
00e791 |
diff --git a/shim.h b/shim.h
|
|
|
00e791 |
index c26d5f06538..e4d40505f09 100644
|
|
|
00e791 |
--- a/shim.h
|
|
|
00e791 |
+++ b/shim.h
|
|
|
00e791 |
@@ -122,9 +122,6 @@
|
|
|
00e791 |
#include "include/variables.h"
|
|
|
00e791 |
|
|
|
00e791 |
#include "version.h"
|
|
|
00e791 |
-#ifdef ENABLE_SHIM_CERT
|
|
|
00e791 |
-#include "shim_cert.h"
|
|
|
00e791 |
-#endif
|
|
|
00e791 |
|
|
|
00e791 |
INTERFACE_DECL(_SHIM_LOCK);
|
|
|
00e791 |
|
|
|
00e791 |
@@ -172,6 +169,10 @@ extern UINT32 vendor_cert_size;
|
|
|
00e791 |
extern UINT32 vendor_dbx_size;
|
|
|
00e791 |
extern UINT8 *vendor_cert;
|
|
|
00e791 |
extern UINT8 *vendor_dbx;
|
|
|
00e791 |
+#if defined(ENABLE_SHIM_CERT)
|
|
|
00e791 |
+extern UINT32 build_cert_size;
|
|
|
00e791 |
+extern UINT8 *build_cert;
|
|
|
00e791 |
+#endif /* defined(ENABLE_SHIM_CERT) */
|
|
|
00e791 |
|
|
|
00e791 |
extern UINT8 user_insecure_mode;
|
|
|
00e791 |
extern UINT8 ignore_db;
|
|
|
00e791 |
--
|
|
|
00e791 |
2.26.2
|
|
|
00e791 |
|