summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhang sanshan <sanshan.zhang@nxp.com>2017-10-30 12:47:13 +0800
committerzhang sanshan <sanshan.zhang@nxp.com>2017-10-30 16:04:05 +0800
commit325ac1e076344e8673ff5d8b64636c6ba4025a3a (patch)
treedb21b22bb67cd7745112f7f1f20767c8ce26badb
parent3c15e0065bdf470788390d4af59bf94aea9dedf5 (diff)
MA-10552-10 [Android] enable A/B system in android
CAAM do not work in imx8. disable FASTBOOT_ENCRYPT_LOCK for lock&unlock and return 0 for fsl avb call back on imx8 device. Change-Id: I1fcce88c3fbc7e1cad1e0cc6e558d1e24516b397 Signed-off-by: Wang Haoran <elven.wang@nxp.com>
-rw-r--r--drivers/usb/gadget/fastboot_lock_unlock.h2
-rw-r--r--lib/avb/Makefile1
-rw-r--r--lib/avb/fsl/fsl_avb.c1
-rw-r--r--lib/avb/fsl/fsl_avbkey.c40
4 files changed, 43 insertions, 1 deletions
diff --git a/drivers/usb/gadget/fastboot_lock_unlock.h b/drivers/usb/gadget/fastboot_lock_unlock.h
index 380be1aa6e..f08ab269bb 100644
--- a/drivers/usb/gadget/fastboot_lock_unlock.h
+++ b/drivers/usb/gadget/fastboot_lock_unlock.h
@@ -34,7 +34,9 @@
#define ALIGN_BYTES 64 /*armv7 cache line need 64 bytes aligned */
//#define FASTBOOT_LOCK_DEBUG
+#ifdef CONFIG_FSL_CAAM_KB
#define FASTBOOT_ENCRYPT_LOCK
+#endif
#ifdef FASTBOOT_LOCK_DEBUG
#define FB_DEBUG(format, ...) printf(format, ##__VA_ARGS__)
diff --git a/lib/avb/Makefile b/lib/avb/Makefile
index f5a264a866..7957fa2aa9 100644
--- a/lib/avb/Makefile
+++ b/lib/avb/Makefile
@@ -5,6 +5,7 @@ subdir-ccflags-y += -D_FILE_OFFSET_BITS=64 \
-Wall \
-Wextra \
-Wformat=2 \
+ -Wno-type-limits \
-Wno-psabi \
-Wno-unused-parameter \
-ffunction-sections \
diff --git a/lib/avb/fsl/fsl_avb.c b/lib/avb/fsl/fsl_avb.c
index d4c4d72d6c..59c7c0af96 100644
--- a/lib/avb/fsl/fsl_avb.c
+++ b/lib/avb/fsl/fsl_avb.c
@@ -9,7 +9,6 @@
#include <stdlib.h>
#include <fsl_fastboot.h>
-#include <fsl_caam.h>
#include "../../../drivers/usb/gadget/fastboot_lock_unlock.h"
#include <fsl_avb.h>
diff --git a/lib/avb/fsl/fsl_avbkey.c b/lib/avb/fsl/fsl_avbkey.c
index 9f2f11a82c..1772715dc6 100644
--- a/lib/avb/fsl/fsl_avbkey.c
+++ b/lib/avb/fsl/fsl_avbkey.c
@@ -6,7 +6,9 @@
#include <common.h>
#include <stdlib.h>
+#ifdef CONFIG_FSL_CAAM_KB
#include <fsl_caam.h>
+#endif
#include <fuse.h>
#include <mmc.h>
@@ -25,6 +27,43 @@
#define RPMBKEY_FUSE_LEN ((RPMBKEY_LENGTH) + (CAAM_PAD))
#define RPMBKEY_FUSE_LENW (RPMBKEY_FUSE_LEN / 4)
+
+#ifndef CONFIG_FSL_CAAM_KB
+/* ARM64 won't avbkey and rollback index in this stage directly. */
+int avbkey_init(uint8_t *plainkey, uint32_t keylen) {
+ return 0;
+}
+
+int rbkidx_erase(void) {
+ return 0;
+}
+
+/*
+ * In no security enhanced ARM64, we cannot protect public key.
+ * So that we choose to trust the key from vbmeta image
+ */
+AvbIOResult fsl_validate_vbmeta_public_key_rpmb(AvbOps* ops,
+ const uint8_t* public_key_data,
+ size_t public_key_length,
+ const uint8_t* public_key_metadata,
+ size_t public_key_metadata_length,
+ bool* out_is_trusted) {
+ *out_is_trusted = true;
+ return AVB_IO_RESULT_OK;
+}
+
+/* In no security enhanced ARM64, rollback index has no protection so no use it */
+AvbIOResult fsl_write_rollback_index_rpmb(AvbOps* ops, size_t rollback_index_slot,
+ uint64_t rollback_index) {
+ return AVB_IO_RESULT_OK;
+
+}
+AvbIOResult fsl_read_rollback_index_rpmb(AvbOps* ops, size_t rollback_index_slot,
+ uint64_t* out_rollback_index) {
+ *out_rollback_index = 0;
+ return AVB_IO_RESULT_OK;
+}
+#else
static int mmc_dev_no = -1;
static struct mmc *get_mmc(void) {
@@ -715,3 +754,4 @@ fail:
free(plain_idx);
return ret;
}
+#endif /* CONFIG_FSL_CAAM_KB */