summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2020-06-18 10:52:37 +0800
committerJi Luo <ji.luo@nxp.com>2022-04-18 16:40:09 +0800
commitdbe3d7726816b0efad5c605b7702177428b245d9 (patch)
treeb1d03166019ba08c5531f6716a57e4da6c859cab
parent3a9cea328057ba484f8884d32a5e0a6ed5b2b24d (diff)
MA-17390 Clean build warnings for android
This commit eliminate the annoying build warning logs. Test: builds with buildman. Signed-off-by: Ji Luo <ji.luo@nxp.com> Change-Id: Ia335dafe3f4c0eab08e011215b9de5d2974b8d0c (cherry picked from commit 85e0d429d19b8f9a62369a5f20e088644c488b1e) (cherry picked from commit 52471735760a8d3a410f88c144910a07a161028d) (cherry picked from commit c0ed4a68aecf0cf67d61c72c273fcd655682366f)
-rw-r--r--arch/arm/mach-imx/image-container.c2
-rw-r--r--arch/arm/mach-imx/imx8/fdt.c4
-rw-r--r--arch/arm/mach-imx/imx8m/soc.c2
-rw-r--r--board/freescale/imx8mp_evk/imx8mp_evk.c1
-rw-r--r--common/spl/spl_mmc.c2
-rw-r--r--drivers/fastboot/fb_fsl/bcb.c1
-rw-r--r--drivers/fastboot/fb_fsl/fastboot_lock_unlock.c5
-rw-r--r--drivers/fastboot/fb_fsl/fb_fsl_boot.c13
-rw-r--r--drivers/fastboot/fb_fsl/fb_fsl_command.c2
-rw-r--r--include/trusty/keymaster.h22
-rw-r--r--include/trusty/sysdeps.h1
-rw-r--r--lib/avb/Makefile1
-rw-r--r--lib/avb/fsl/fsl_avb_ab_flow.c1
-rw-r--r--lib/avb/fsl/fsl_avbkey.c4
-rw-r--r--lib/avb/fsl/utils.c1
-rw-r--r--lib/avb/libavb_atx/avb_atx_ops.h2
-rw-r--r--lib/avb/libavb_atx/avb_atx_types.h2
-rw-r--r--lib/avb/libavb_atx/libavb_atx.h2
-rw-r--r--lib/libavb/avb_slot_verify.c8
-rw-r--r--lib/trusty/ql-tipc/hwcrypto.c3
-rw-r--r--lib/trusty/ql-tipc/libtipc.c2
-rw-r--r--lib/trusty/ql-tipc/sysdeps/sysdeps_uboot.c2
22 files changed, 66 insertions, 17 deletions
diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c
index 90296637a41..b857a48da17 100644
--- a/arch/arm/mach-imx/image-container.c
+++ b/arch/arm/mach-imx/image-container.c
@@ -231,7 +231,7 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type)
return offset;
}
-static ulong get_imageset_end(void *dev, int dev_type)
+static __maybe_unused ulong get_imageset_end(void *dev, int dev_type)
{
unsigned long offset[3] = {};
int value_container[3] = {};
diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c
index 95d536e8bef..a9560714e18 100644
--- a/arch/arm/mach-imx/imx8/fdt.c
+++ b/arch/arm/mach-imx/imx8/fdt.c
@@ -155,7 +155,7 @@ static int fdt_edma_get_channel_id(u32 *regs, int index, struct edma_ch_map *edm
return ch_id;
}
-static void update_fdt_edma_nodes(void *blob)
+static __maybe_unused void update_fdt_edma_nodes(void *blob)
{
struct edma_ch_map edma_qm[] = {
{ SC_R_DMA_0_CH0, 0x5a200000, 32, "/dma-controller@5a1f0000"},
@@ -384,7 +384,7 @@ static void update_fdt_with_owned_resources_legacy(void *blob)
}
}
-static void update_fdt_with_owned_resources(void *blob)
+static __maybe_unused void update_fdt_with_owned_resources(void *blob)
{
/*
* Traverses the fdt nodes, check its power domain and use
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 0fbfd31085d..f236ee157df 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -1511,7 +1511,7 @@ void reset_cpu(void)
#endif
#if defined(CONFIG_ARCH_MISC_INIT)
-static void acquire_buildinfo(void)
+static __maybe_unused void acquire_buildinfo(void)
{
u64 atf_commit = 0;
struct arm_smccc_res res;
diff --git a/board/freescale/imx8mp_evk/imx8mp_evk.c b/board/freescale/imx8mp_evk/imx8mp_evk.c
index 54bfbf33c8c..9b04d4721c6 100644
--- a/board/freescale/imx8mp_evk/imx8mp_evk.c
+++ b/board/freescale/imx8mp_evk/imx8mp_evk.c
@@ -27,6 +27,7 @@
#include <dwc3-uboot.h>
#include <imx_sip.h>
#include <linux/arm-smccc.h>
+#include <mmc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index c3186e2153c..591c238a632 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -77,7 +77,7 @@ static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part)
return 0;
}
-#if defined(CONFIG_IMX_TRUSTY_OS)
+#if defined(CONFIG_DUAL_BOOTLOADER)
int mmc_load_image_raw_sector_dual_uboot(struct spl_image_info *spl_image,
struct mmc *mmc);
#endif
diff --git a/drivers/fastboot/fb_fsl/bcb.c b/drivers/fastboot/fb_fsl/bcb.c
index 58073219e58..a698ec8c997 100644
--- a/drivers/fastboot/fb_fsl/bcb.c
+++ b/drivers/fastboot/fb_fsl/bcb.c
@@ -11,6 +11,7 @@
#include <g_dnl.h>
#include <mmc.h>
#include "bcb.h"
+#include "command.h"
#define ALIGN_BYTES 64 /*armv7 cache line need 64 bytes aligned */
static ulong get_block_size(char *ifname, int dev)
diff --git a/drivers/fastboot/fb_fsl/fastboot_lock_unlock.c b/drivers/fastboot/fb_fsl/fastboot_lock_unlock.c
index b234c07fbe4..268ad06d1e8 100644
--- a/drivers/fastboot/fb_fsl/fastboot_lock_unlock.c
+++ b/drivers/fastboot/fb_fsl/fastboot_lock_unlock.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <mapmem.h>
#include <linux/types.h>
+#include <linux/delay.h>
#include <part.h>
#include <mmc.h>
#include <ext_common.h>
@@ -19,6 +20,8 @@
#include <asm/mach-imx/hab.h>
#endif
+#include <fsl_avb.h>
+
#ifdef FASTBOOT_ENCRYPT_LOCK
#include <hash.h>
@@ -144,7 +147,7 @@ static int generate_salt(unsigned char* salt) {
}
-static FbLockState decrypt_lock_store(unsigned char *bdata) {
+static __maybe_unused FbLockState decrypt_lock_store(unsigned char *bdata) {
int p = 0, ret;
ALLOC_CACHE_ALIGN_BUFFER(uint8_t, plain_data, ENDATA_LEN);
ALLOC_CACHE_ALIGN_BUFFER(uint8_t, keymod, 16);
diff --git a/drivers/fastboot/fb_fsl/fb_fsl_boot.c b/drivers/fastboot/fb_fsl/fb_fsl_boot.c
index d7afb309318..2cf6d76d6e9 100644
--- a/drivers/fastboot/fb_fsl/fb_fsl_boot.c
+++ b/drivers/fastboot/fb_fsl/fb_fsl_boot.c
@@ -40,6 +40,7 @@
#ifdef CONFIG_IMX_TRUSTY_OS
#include "u-boot/sha256.h"
#include <trusty/libtipc.h>
+#include <trusty/hwcrypto.h>
#endif
#include "fb_fsl_common.h"
@@ -439,8 +440,12 @@ fail:
}
#endif /* CONFIG_DUAL_BOOTLOADER && CONFIG_AVB_ATX */
-int trusty_setbootparameter(struct andr_img_hdr *hdr, AvbABFlowResult avb_result,
- AvbSlotVerifyData *avb_out_data) {
+#ifdef CONFIG_VENDOR_BOOT_SUPPORT
+int trusty_setbootparameter(struct boot_img_hdr_v3 *hdr,
+#else
+int trusty_setbootparameter(struct andr_img_hdr *hdr,
+#endif
+ AvbABFlowResult avb_result, AvbSlotVerifyData *avb_out_data) {
#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_AVB_ATX)
uint8_t vbh[AVB_SHA256_DIGEST_SIZE];
#endif
@@ -492,7 +497,9 @@ int trusty_setbootparameter(struct andr_img_hdr *hdr, AvbABFlowResult avb_result
NULL, 0);
#endif
+#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_AVB_ATX)
fail:
+#endif
return ret;
}
#endif
@@ -851,7 +858,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
dt_entry = (struct dt_table_entry *)((ulong)dt_img +
be32_to_cpu(dt_img->dt_entries_offset));
fdt_size = be32_to_cpu(dt_entry->dt_size);
- memcpy((void *)fdt_addr, (void *)((ulong)dt_img +
+ memcpy((void *)(ulong)fdt_addr, (void *)((ulong)dt_img +
be32_to_cpu(dt_entry->dt_offset)), fdt_size);
#endif /*CONFIG_OF_LIBFDT*/
diff --git a/drivers/fastboot/fb_fsl/fb_fsl_command.c b/drivers/fastboot/fb_fsl/fb_fsl_command.c
index 679757a0a69..301c776d779 100644
--- a/drivers/fastboot/fb_fsl/fb_fsl_command.c
+++ b/drivers/fastboot/fb_fsl/fb_fsl_command.c
@@ -402,7 +402,7 @@ static FbLockState do_fastboot_unlock(bool force)
char *serial = get_serial();
status = trusty_verify_secure_unlock(fastboot_buf_addr,
fastboot_bytes_received,
- serial, 16);
+ (uint8_t *)serial, 16);
if (status < 0) {
printf("verify secure unlock credential fail due Trusty return %d\n", status);
return FASTBOOT_LOCK_ERROR;
diff --git a/include/trusty/keymaster.h b/include/trusty/keymaster.h
index 3776dbc5a54..a44ae21987a 100644
--- a/include/trusty/keymaster.h
+++ b/include/trusty/keymaster.h
@@ -86,6 +86,28 @@ int trusty_append_attestation_cert_chain(const uint8_t *cert,
uint32_t cert_size,
keymaster_algorithm_t algorithm);
/*
+ * Set encrypted Keymaster attestation key. Returns one of trusty_err.
+ *
+ * @key: buffer containing encrypted key
+ * @key_size: size of key in bytes
+ * @algorithm: one of KM_ALGORITHM_RSA or KM_ALGORITHM_EC
+ */
+int trusty_set_attestation_key_enc(const uint8_t *key,
+ uint32_t key_size,
+ keymaster_algorithm_t algorithm);
+
+/*
+ * Append encrypted certificate to Keymaster attestation certificate chain. Returns
+ * one of trusty_err.
+ *
+ * @cert: buffer containing encrypted certificate
+ * @cert_size: size of certificate in bytes
+ * @algorithm: one of KM_ALGORITHM_RSA or KM_ALGORITHM_EC
+ */
+int trusty_append_attestation_cert_chain_enc(const uint8_t *cert,
+ uint32_t cert_size,
+ keymaster_algorithm_t algorithm);
+/*
* Reads a CA Request from Keymaster. On success allocates a new CA Request
* message at |*ca_request_p|, and the caller takes ownership. Returns one
* of trusty_err.
diff --git a/include/trusty/sysdeps.h b/include/trusty/sysdeps.h
index 1f26bbd4c3d..b21a29ca08d 100644
--- a/include/trusty/sysdeps.h
+++ b/include/trusty/sysdeps.h
@@ -31,6 +31,7 @@
*/
#include <common.h>
#include <compiler.h>
+#include <irq_func.h>
/*
* These attribute macros may need to be adjusted if not using gcc or clang.
diff --git a/lib/avb/Makefile b/lib/avb/Makefile
index 21af6a2029f..0c5e2cf0119 100644
--- a/lib/avb/Makefile
+++ b/lib/avb/Makefile
@@ -8,6 +8,7 @@ subdir-ccflags-y += -I./lib \
-Wno-type-limits \
-Wno-psabi \
-Wno-unused-parameter \
+ -Wno-sign-compare \
-ffunction-sections \
-std=gnu99
diff --git a/lib/avb/fsl/fsl_avb_ab_flow.c b/lib/avb/fsl/fsl_avb_ab_flow.c
index 4382e413c51..bf9ac53f2a7 100644
--- a/lib/avb/fsl/fsl_avb_ab_flow.c
+++ b/lib/avb/fsl/fsl_avb_ab_flow.c
@@ -11,6 +11,7 @@
#include "utils.h"
#include "fsl_caam.h"
#include "fsl_avbkey.h"
+#include "hang.h"
#if defined(CONFIG_DUAL_BOOTLOADER) || !defined(CONFIG_SPL_BUILD)
static const char* slot_suffixes[2] = {"_a", "_b"};
diff --git a/lib/avb/fsl/fsl_avbkey.c b/lib/avb/fsl/fsl_avbkey.c
index 63b99bba21e..fcdbe89613e 100644
--- a/lib/avb/fsl/fsl_avbkey.c
+++ b/lib/avb/fsl/fsl_avbkey.c
@@ -10,6 +10,8 @@
#include <mmc.h>
#include <hash.h>
#include <mapmem.h>
+#include <hang.h>
+#include <cpu_func.h>
#include <fsl_avb.h>
#include <fsl_sec.h>
@@ -798,7 +800,9 @@ int check_rpmb_blob(struct mmc *mmc)
int ret = 0;
char original_part;
struct keyslot_package kp;
+#if CONFIG_IS_ENABLED(BLK)
struct blk_desc *dev_desc = NULL;
+#endif
read_keyslot_package(&kp);
if (strcmp(kp.magic, KEYPACK_MAGIC)) {
diff --git a/lib/avb/fsl/utils.c b/lib/avb/fsl/utils.c
index 94a72e8e6ab..3e70d576c81 100644
--- a/lib/avb/fsl/utils.c
+++ b/lib/avb/fsl/utils.c
@@ -6,6 +6,7 @@
+ */
#include <common.h>
#include <stdlib.h>
+#include <part.h>
#include "debug.h"
#include "utils.h"
diff --git a/lib/avb/libavb_atx/avb_atx_ops.h b/lib/avb/libavb_atx/avb_atx_ops.h
index 53c898d623d..e7bd686f3d7 100644
--- a/lib/avb/libavb_atx/avb_atx_ops.h
+++ b/lib/avb/libavb_atx/avb_atx_ops.h
@@ -30,7 +30,7 @@
#ifndef AVB_ATX_OPS_H_
#define AVB_ATX_OPS_H_
-#include <libavb/libavb.h>
+#include <../lib/libavb/libavb.h>
#include "avb_atx_types.h"
diff --git a/lib/avb/libavb_atx/avb_atx_types.h b/lib/avb/libavb_atx/avb_atx_types.h
index e78bbfa78c2..a4563c0d080 100644
--- a/lib/avb/libavb_atx/avb_atx_types.h
+++ b/lib/avb/libavb_atx/avb_atx_types.h
@@ -30,7 +30,7 @@
#ifndef AVB_ATX_TYPES_H_
#define AVB_ATX_TYPES_H_
-#include <libavb/libavb.h>
+#include <../lib/libavb/libavb.h>
#ifdef __cplusplus
extern "C" {
diff --git a/lib/avb/libavb_atx/libavb_atx.h b/lib/avb/libavb_atx/libavb_atx.h
index 839c0afa98c..3d830ac831e 100644
--- a/lib/avb/libavb_atx/libavb_atx.h
+++ b/lib/avb/libavb_atx/libavb_atx.h
@@ -25,7 +25,7 @@
#ifndef LIBAVB_ATX_H_
#define LIBAVB_ATX_H_
-#include <libavb/libavb.h>
+#include <../lib/libavb/libavb.h>
/* The AVB_INSIDE_LIBAVB_ATX_H preprocessor symbol is used to enforce
* library users to include only this file. All public interfaces, and
diff --git a/lib/libavb/avb_slot_verify.c b/lib/libavb/avb_slot_verify.c
index 108cf29d64d..436983771c2 100644
--- a/lib/libavb/avb_slot_verify.c
+++ b/lib/libavb/avb_slot_verify.c
@@ -16,9 +16,9 @@
#include "avb_version.h"
#include <log.h>
#include <malloc.h>
+#include <memalign.h>
#if defined(CONFIG_IMX_TRUSTY_OS) && !defined(CONFIG_AVB_ATX)
#include "trusty/hwcrypto.h"
-#include <memalign.h>
#endif
/* Maximum number of partitions that can be loaded with avb_slot_verify(). */
@@ -295,7 +295,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(
bool image_preloaded = false;
uint8_t* digest;
size_t digest_len;
- const char* found;
+ const char* found = NULL;
uint64_t image_size;
size_t expected_digest_len = 0;
uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];
@@ -395,7 +395,9 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(
// Although only one of the type might be used, we have to defined the
// structure here so that they would live outside the 'if/else' scope to be
// used later.
+#if !defined(CONFIG_IMX_TRUSTY_OS) || defined(CONFIG_AVB_ATX) || defined(CONFIG_XEN)
AvbSHA256Ctx sha256_ctx;
+#endif
AvbSHA512Ctx sha512_ctx;
size_t image_size_to_hash = hash_desc.image_size;
// If we allow verification error and the whole partition is smaller than
@@ -412,8 +414,6 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(
ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
goto out;
}
- uint32_t round_buf_size = ROUND(hash_desc.salt_len + image_size_to_hash,
- ARCH_DMA_MINALIGN);
hash_buf = (void *)CONFIG_FASTBOOT_BUF_ADDR;
avb_memcpy(hash_buf, desc_salt, hash_desc.salt_len);
diff --git a/lib/trusty/ql-tipc/hwcrypto.c b/lib/trusty/ql-tipc/hwcrypto.c
index 051a505aa9f..9de113a1665 100644
--- a/lib/trusty/ql-tipc/hwcrypto.c
+++ b/lib/trusty/ql-tipc/hwcrypto.c
@@ -27,7 +27,10 @@
#include <trusty/rpmb.h>
#include <trusty/trusty_ipc.h>
#include <trusty/util.h>
+#include <memalign.h>
#include "common.h"
+#include <cpu_func.h>
+#include <hang.h>
#define LOCAL_LOG 0
#define CAAM_KB_HEADER_LEN 48
diff --git a/lib/trusty/ql-tipc/libtipc.c b/lib/trusty/ql-tipc/libtipc.c
index 30d4bbf854e..92c842be2cd 100644
--- a/lib/trusty/ql-tipc/libtipc.c
+++ b/lib/trusty/ql-tipc/libtipc.c
@@ -31,6 +31,8 @@
#include <trusty/trusty_dev.h>
#include <trusty/trusty_ipc.h>
#include <trusty/util.h>
+#include <hang.h>
+#include <env.h>
#define LOCAL_LOG 0
diff --git a/lib/trusty/ql-tipc/sysdeps/sysdeps_uboot.c b/lib/trusty/ql-tipc/sysdeps/sysdeps_uboot.c
index b42cd20d4f7..589e9e12ef6 100644
--- a/lib/trusty/ql-tipc/sysdeps/sysdeps_uboot.c
+++ b/lib/trusty/ql-tipc/sysdeps/sysdeps_uboot.c
@@ -24,6 +24,8 @@
#include <trusty/sysdeps.h>
+#include <asm/system.h>
+#include <command.h>
#include <common.h>
#include <linux/string.h>
#include <malloc.h>