Commit a5c11e6c authored by Marek Vasut's avatar Marek Vasut

mxssb: Update the command checksum in postfill function

Update the checksum of the command right after we have all necessary
information filled in it instead of doing it late in the function that
encrypts the command.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent 391834c4
......@@ -355,8 +355,6 @@ static void sb_encrypt_tag(struct sb_image_ctx *ictx,
EVP_MD_CTX *md_ctx = &ictx->md_ctx;
struct sb_command *cmd = &cctx->payload;
cmd->header.checksum = sb_command_checksum(cmd);
sb_aes_encrypt(ictx, (uint8_t *)cmd,
(uint8_t *)&cctx->c_payload, sizeof(*cmd));
EVP_DigestUpdate(md_ctx, &cctx->c_payload, sizeof(*cmd));
......@@ -869,8 +867,11 @@ static int sb_fixup_sections_and_tags(struct sb_image_ctx *ictx)
ccmd->tag.section_number = shdr->section_number;
ccmd->tag.section_length = shdr->section_size;
ccmd->tag.section_flags = shdr->section_flags;
break;
}
/* Update the command checksum. */
ccmd->header.checksum = sb_command_checksum(ccmd);
cctx = cctx->cmd;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment