summaryrefslogtreecommitdiff
path: root/board/freescale/common/fsl_validate.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-11-11 09:04:20 -0500
committerTom Rini <trini@konsulko.com>2021-11-11 09:04:20 -0500
commit1e72ad6b387c599f477f83cda67ab525c089a9b0 (patch)
treee9902c9fb94534a8c98d880db36a74a8ec17e173 /board/freescale/common/fsl_validate.c
parent166a77b34b30f64f7b12a3016b0bba49d568c52e (diff)
parent99e1fa89f1a6ce13787af34cbd933c846bc7e93a (diff)
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
- device-tree sync-up with Linux for ls1028a - fixes/update in fsl-ddr driver, fsl-validate, lx2162a, fsl-mc, spintable code, configs, qspi node, pci - enable EFI_SET_TIME support in sl28 - powerpc: Drop -mstring
Diffstat (limited to 'board/freescale/common/fsl_validate.c')
-rw-r--r--board/freescale/common/fsl_validate.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c
index c90afe2e210..34875d0b8f2 100644
--- a/board/freescale/common/fsl_validate.c
+++ b/board/freescale/common/fsl_validate.c
@@ -499,12 +499,8 @@ static int calc_img_key_hash(struct fsl_secboot_img_priv *img)
return ret;
ret = algo->hash_init(algo, &ctx);
- if (ret) {
- if (ctx)
- free(ctx);
+ if (ret)
return ret;
- }
-
/* Update hash for ESBC key */
#ifdef CONFIG_KEY_REVOCATION
if (check_srk(img)) {
@@ -519,15 +515,12 @@ static int calc_img_key_hash(struct fsl_secboot_img_priv *img)
img->img_key, img->key_len, 1);
if (ret)
return ret;
-
/* Copy hash at destination buffer */
ret = algo->hash_finish(algo, ctx, hash_val, algo->digest_size);
if (ret) {
- if (ctx)
- free(ctx);
+ free(ctx);
return ret;
}
-
for (i = 0; i < SHA256_BYTES; i++)
img->img_key_hash[i] = hash_val[i];
@@ -554,18 +547,14 @@ static int calc_esbchdr_esbc_hash(struct fsl_secboot_img_priv *img)
ret = algo->hash_init(algo, &ctx);
/* Copy hash at destination buffer */
- if (ret) {
- free(ctx);
+ if (ret)
return ret;
- }
/* Update hash for CSF Header */
ret = algo->hash_update(algo, ctx,
(u8 *)&img->hdr, sizeof(struct fsl_secboot_img_hdr), 0);
- if (ret) {
- free(ctx);
+ if (ret)
return ret;
- }
/* Update the hash with that of srk table if srk flag is 1
* If IE Table is selected, key is not added in the hash
@@ -592,22 +581,17 @@ static int calc_esbchdr_esbc_hash(struct fsl_secboot_img_priv *img)
key_hash = 1;
}
#endif
- if (ret) {
- free(ctx);
+ if (ret)
return ret;
- }
if (!key_hash) {
free(ctx);
return ERROR_KEY_TABLE_NOT_FOUND;
}
-
/* Update hash for actual Image */
ret = algo->hash_update(algo, ctx,
(u8 *)(*(img->img_addr_ptr)), img->img_size, 1);
- if (ret) {
- free(ctx);
+ if (ret)
return ret;
- }
/* Copy hash at destination buffer */
ret = algo->hash_finish(algo, ctx, hash_val, algo->digest_size);