X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fspl%2Fspl_fit.c;h=be92ca4b4fd0f0ce04a6e360429d04e420f2c230;hb=ee3db4fc04714c80196e49f8f3a5f157f20d2862;hp=72ae8f4c50310e26eb95b7c14eef62b99a6143ff;hpb=6e6cf015e7cdd7ca83a933320a81201972bd5e5e;p=u-boot diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 72ae8f4c50..be92ca4b4f 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #ifndef CONFIG_SYS_BOOTM_LEN @@ -173,6 +173,10 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, int align_len = ARCH_DMA_MINALIGN - 1; uint8_t image_comp = -1, type = -1; const void *data; + bool external_data = false; +#ifdef CONFIG_SPL_FIT_SIGNATURE + int ret; +#endif if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) { if (fit_image_get_comp(fit, node, &image_comp)) @@ -189,9 +193,15 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, if (fit_image_get_load(fit, node, &load_addr)) load_addr = image_info->load_addr; - if (!fit_image_get_data_offset(fit, node, &offset)) { - /* External data */ + if (!fit_image_get_data_position(fit, node, &offset)) { + external_data = true; + } else if (!fit_image_get_data_offset(fit, node, &offset)) { offset += base_offset; + external_data = true; + } + + if (external_data) { + /* External data */ if (fit_image_get_data_size(fit, node, &len)) return -ENOENT; @@ -245,7 +255,16 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, image_info->entry_point = fdt_getprop_u32(fit, node, "entry"); } +#ifdef CONFIG_SPL_FIT_SIGNATURE + printf("## Checking hash(es) for Image %s ...\n", + fit_get_name(fit, node, NULL)); + ret = fit_image_verify_with_data(fit, node, + (const void *)load_addr, length); + printf("\n"); + return !ret; +#else return 0; +#endif } static int spl_fit_append_fdt(struct spl_image_info *spl_image,