MA-10552-10 [Android] enable A/B system in android
authorzhang sanshan <sanshan.zhang@nxp.com>
Mon, 30 Oct 2017 09:19:45 +0000 (17:19 +0800)
committerJason Liu <jason.hui.liu@nxp.com>
Thu, 2 Nov 2017 18:37:29 +0000 (02:37 +0800)
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: I79e2de2571a922ae22c2a52f0beb661762e11dd5
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
drivers/usb/gadget/fastboot_lock_unlock.h
lib/avb/Makefile
lib/avb/fsl/fsl_avb.c
lib/avb/fsl/fsl_avbkey.c

index 380be1a..f08ab26 100644 (file)
@@ -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__)
index a80a17e..ea0fd22 100644 (file)
@@ -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 \
index d4c4d72..59c7c0a 100644 (file)
@@ -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>
index ff55a3a..0d99e8c 100644 (file)
@@ -7,7 +7,9 @@
 
 #include <common.h>
 #include <stdlib.h>
+#ifdef CONFIG_FSL_CAAM_KB
 #include <fsl_caam.h>
+#endif
 #include <fuse.h>
 #include <mmc.h>
 #include <hash.h>
 #define RESULT_ERROR -1
 #define RESULT_OK     0
 
+#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) {
@@ -1074,6 +1112,7 @@ fail:
                free(plain_idx);
        return ret;
 }
+#endif /* CONFIG_FSL_CAAM_KB */
 
 #if defined(AVB_RPMB) && defined(CONFIG_AVB_ATX)
 /* Reads permanent |attributes| data. There are no restrictions on where this