diff options
author | Gerald Van Baren <gvb@unssw.com> | 2012-10-22 20:42:09 -0400 |
---|---|---|
committer | Gerald Van Baren <gvb@unssw.com> | 2012-10-22 20:42:09 -0400 |
commit | cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a (patch) | |
tree | 3dd515f19084bb1e4ae2afc8d51888edc294d752 /common/image.c | |
parent | bcf28c23f2195a91e0713337934f630a9c7bc5a9 (diff) | |
parent | c71b64f3617b5a4362c6e4e0aefdd66d6ac6affd (diff) | |
download | u-boot-imx-cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a.zip u-boot-imx-cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a.tar.gz u-boot-imx-cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a.tar.bz2 |
Merge branch 'next'
Diffstat (limited to 'common/image.c')
-rw-r--r-- | common/image.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/common/image.c b/common/image.c index f084d2b..750a98b 100644 --- a/common/image.c +++ b/common/image.c @@ -2496,6 +2496,36 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value, return 0; } +#ifndef USE_HOSTCC +/** + * fit_image_hash_get_ignore - get hash ignore flag + * @fit: pointer to the FIT format image header + * @noffset: hash node offset + * @ignore: pointer to an int, will hold hash ignore flag + * + * fit_image_hash_get_ignore() finds hash ignore property in a given hash node. + * If the property is found and non-zero, the hash algorithm is not verified by + * u-boot automatically. + * + * returns: + * 0, on ignore not found + * value, on ignore found + */ +int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore) +{ + int len; + int *value; + + value = (int *)fdt_getprop(fit, noffset, FIT_IGNORE_PROP, &len); + if (value == NULL || len != sizeof(int)) + *ignore = 0; + else + *ignore = *value; + + return 0; +} +#endif + /** * fit_set_timestamp - set node timestamp property * @fit: pointer to the FIT format image header @@ -2759,6 +2789,9 @@ int fit_image_check_hashes(const void *fit, int image_noffset) char *algo; uint8_t *fit_value; int fit_value_len; +#ifndef USE_HOSTCC + int ignore; +#endif uint8_t value[FIT_MAX_HASH_LEN]; int value_len; int noffset; @@ -2795,6 +2828,14 @@ int fit_image_check_hashes(const void *fit, int image_noffset) } printf("%s", algo); +#ifndef USE_HOSTCC + fit_image_hash_get_ignore(fit, noffset, &ignore); + if (ignore) { + printf("-skipped "); + continue; + } +#endif + if (fit_image_hash_get_value(fit, noffset, &fit_value, &fit_value_len)) { err_msg = " error!\nCan't get hash value " @@ -2820,6 +2861,11 @@ int fit_image_check_hashes(const void *fit, int image_noffset) } } + if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) { + err_msg = " error!\nCorrupted or truncated tree"; + goto error; + } + return 1; error: |