vboot/secdata: fix 2secdata.h includes
Get rid of vb2_context forward declaration and vb2_error_t
redefinition from 2secdata.h, and properly include 2api.h
instead.
Remove 2secdata.h from 2api.h (should not be publicly
accessible), and add 2secdata.h include to appropriate files.
BUG=b:124141368, chromium:972956
TEST=make clean && make runtests
BRANCH=none
Change-Id: I15570488fdabfcd9a178a0cedc7868b8c23720e9
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776285
Tested-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 9ca0199..8a12731 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -26,7 +26,6 @@
#include "2id.h"
#include "2recovery_reasons.h"
#include "2return_codes.h"
-#include "2secdata.h"
/* TODO(chromium:972956): Remove once coreboot is using updated names */
#define secdata secdata_firmware
diff --git a/firmware/2lib/include/2secdata.h b/firmware/2lib/include/2secdata.h
index 6931278..0bbce4f 100644
--- a/firmware/2lib/include/2secdata.h
+++ b/firmware/2lib/include/2secdata.h
@@ -8,9 +8,7 @@
#ifndef VBOOT_REFERENCE_2SECDATA_H_
#define VBOOT_REFERENCE_2SECDATA_H_
-/* Avoid circular dependency with 2api.h */
-struct vb2_context;
-typedef uint32_t vb2_error_t;
+#include "2api.h"
/*****************************************************************************/
/* Firmware version space */
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 1d54ef6..e2ca910 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -11,6 +11,7 @@
#include "2nvstorage.h"
#include "2rsa.h"
#include "2sha.h"
+#include "2secdata.h"
#include "2sysincludes.h"
#include "cgptlib.h"
#include "cgptlib_internal.h"
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index ec0b812..2203595 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -10,6 +10,7 @@
#include "2misc.h"
#include "2nvstorage.h"
#include "2rsa.h"
+#include "2secdata.h"
#include "ec_sync.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 1b1db81..24b7de8 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -9,6 +9,7 @@
#include "2misc.h"
#include "2nvstorage.h"
#include "2rsa.h"
+#include "2secdata.h"
#include "2sysincludes.h"
#include "ec_sync.h"
#include "load_kernel_fw.h"
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index 7077b1e..011a361 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -14,6 +14,7 @@
#include "2common.h"
#include "2misc.h"
#include "2nvstorage.h"
+#include "2secdata.h"
#include "crc32.h"
#include "host_common.h"
#include "load_kernel_fw.h"
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 1791dc7..c1f4f04 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -12,6 +12,7 @@
#include "2common.h"
#include "2misc.h"
#include "2nvstorage.h"
+#include "2secdata.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c
index 14e0aa3..39bf29d 100644
--- a/tests/vboot_detach_menu_tests.c
+++ b/tests/vboot_detach_menu_tests.c
@@ -12,6 +12,7 @@
#include "2common.h"
#include "2misc.h"
#include "2nvstorage.h"
+#include "2secdata.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"