You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/06/10 23:55:34 UTC
[mynewt-imgmod] 05/09: Warn when `hashable` is used on an encrypted
image
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-imgmod.git
commit 60423a36f9f6da68ee3850e270d5b7f89d3cc43f
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri May 24 12:31:49 2019 -0700
Warn when `hashable` is used on an encrypted image
An image's hash is calculated from the following two inputs:
1. Image header.
2. Unencrypted image body.
The `image hashable` command extracts the header and body from a
complete image. If the image body is encrypted, then the result of this
command will not generate the correct hash.
This commit adds a warning in case `image hashable` is used on an
encrypyted image.
---
cli/image_cmds.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cli/image_cmds.go b/cli/image_cmds.go
index 83b4e8f..4a926a4 100644
--- a/cli/image_cmds.go
+++ b/cli/image_cmds.go
@@ -310,6 +310,11 @@ func runHashableCmd(cmd *cobra.Command, args []string) {
ImgmodUsage(cmd, err)
}
+ if (img.Header.Flags & image.IMAGE_F_ENCRYPTED) != 0 {
+ util.StatusMessage(util.VERBOSITY_QUIET,
+ "* Warning: extracting hashable content from an encrypted image\n")
+ }
+
f, err := os.Create(outFilename)
if err != nil {
ImgmodUsage(nil, util.ChildNewtError(err))