summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-04-25 15:41:35 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-05-18 22:06:24 +0000
commit40ec89fc5bc23d8d340b0f55b931459953b35e55 (patch)
tree75688b45ec9fa1a988ee330fce05390691e6f5ad
parent8bf8189efd53c17ad8ae04c65e8e299c041bed5a (diff)
downloadvboot-40ec89fc5bc23d8d340b0f55b931459953b35e55.tar.gz
vboot: hide 2common.h from external API
2common.h contains code which should be internal to vboot. Most notably of which is 2struct.h, which contains the vb2_shared_data data structure. BUG=b:124141368, chromium:956474 TEST=make clean && make runtests BRANCH=none Change-Id: I852468d52e66d8530eaf6e912338c3ff59c0fdb3 Signed-off-by: Duncan Laurie <dlaurie@google.com> Original-Commit-Id: 8a4f0bef0ec665a24ca3a01b2ee6915e2e392a18 Original-Cq-Depend: chromium:1587981, chromium:1599567, chromium:1610164 Original-Change-Id: I712f51915bb9b0b03dce558e2b843eb83662f434 Original-Signed-off-by: Joel Kitching <kitching@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/1583819 Original-Commit-Ready: Joel Kitching <kitching@chromium.org> Original-Tested-by: Joel Kitching <kitching@chromium.org> Original-Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1618907
-rw-r--r--firmware/2lib/include/2api.h1
-rw-r--r--firmware/2lib/include/2common.h17
-rw-r--r--firmware/2lib/include/2constants.h17
-rw-r--r--futility/futility.h1
-rw-r--r--tests/vboot_api_devmode_tests.c2
-rw-r--r--tests/vboot_api_kernel_tests.c2
6 files changed, 20 insertions, 20 deletions
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 26417c59..eed7e126 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -21,7 +21,6 @@
#define VBOOT_2_API_H_
#include <stdint.h>
-#include "2common.h"
#include "2constants.h"
#include "2crypto.h"
#include "2fw_hash_tags.h"
diff --git a/firmware/2lib/include/2common.h b/firmware/2lib/include/2common.h
index 0a6dccd2..4b80e12c 100644
--- a/firmware/2lib/include/2common.h
+++ b/firmware/2lib/include/2common.h
@@ -45,23 +45,6 @@ struct vb2_public_key;
#endif
#endif
-/*
- * Alignment for work buffer pointers/allocations should be useful for any
- * data type. When declaring workbuf buffers on the stack, the caller should
- * use explicit alignment to avoid run-time errors. For example:
- *
- * int foo(void)
- * {
- * struct vb2_workbuf wb;
- * uint8_t buf[NUM] __attribute__ ((aligned (VB2_WORKBUF_ALIGN)));
- * wb.buf = buf;
- * wb.size = sizeof(buf);
- */
-
-/* We might get away with using __alignof__(void *), but since GCC defines a
- * macro for us we'll be safe and use that. */
-#define VB2_WORKBUF_ALIGN __BIGGEST_ALIGNMENT__
-
/**
* Round up a number to a multiple of VB2_WORKBUF_ALIGN
*
diff --git a/firmware/2lib/include/2constants.h b/firmware/2lib/include/2constants.h
index aa9e99e2..81d1cc56 100644
--- a/firmware/2lib/include/2constants.h
+++ b/firmware/2lib/include/2constants.h
@@ -47,4 +47,21 @@
/* Recommended buffer size for vb2api_get_pcr_digest. */
#define VB2_PCR_DIGEST_RECOMMENDED_SIZE 32
+/*
+ * Alignment for work buffer pointers/allocations should be useful for any
+ * data type. When declaring workbuf buffers on the stack, the caller should
+ * use explicit alignment to avoid run-time errors. For example:
+ *
+ * int foo(void)
+ * {
+ * struct vb2_workbuf wb;
+ * uint8_t buf[NUM] __attribute__ ((aligned (VB2_WORKBUF_ALIGN)));
+ * wb.buf = buf;
+ * wb.size = sizeof(buf);
+ */
+
+/* We might get away with using __alignof__(void *), but since GCC defines a
+ * macro for us we'll be safe and use that. */
+#define VB2_WORKBUF_ALIGN __BIGGEST_ALIGNMENT__
+
#endif /* VBOOT_REFERENCE_2CONSTANTS_H_ */
diff --git a/futility/futility.h b/futility/futility.h
index af5e0f76..9a1ac6dc 100644
--- a/futility/futility.h
+++ b/futility/futility.h
@@ -7,6 +7,7 @@
#define VBOOT_REFERENCE_FUTILITY_H_
#include <stdint.h>
+#include "2common.h"
#include "vboot_common.h"
#include "gbb_header.h"
#include "host_key.h"
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index 9d20e322..286972c2 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include "2sysincludes.h"
-#include "2api.h"
+#include "2common.h"
#include "2misc.h"
#include "2nvstorage.h"
#include "crc32.h"
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index 1bc2c9aa..92f6dcc9 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include "2sysincludes.h"
-#include "2api.h"
+#include "2common.h"
#include "2nvstorage.h"
#include "gbb_header.h"
#include "load_kernel_fw.h"