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:31 UTC
[mynewt-imgmod] 02/09: Set / clear "encrypt" flag in image header
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 f5de3f98578364fbf50887818b02834f1b6f9238
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri May 10 14:24:19 2019 -0700
Set / clear "encrypt" flag in image header
---
iimg/lvimg.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/iimg/lvimg.go b/iimg/lvimg.go
index bacefe9..54ca5ef 100644
--- a/iimg/lvimg.go
+++ b/iimg/lvimg.go
@@ -151,6 +151,9 @@ func DecryptImage(img image.Image, privKeBytes []byte) (image.Image, error) {
}
img.Body = body
+
+ img.Header.Flags &^= image.IMAGE_F_ENCRYPTED
+
return img, nil
}
@@ -185,5 +188,7 @@ func EncryptImage(img image.Image, pubKeBytes []byte) (image.Image, error) {
}
img.Tlvs = append(img.Tlvs, tlv)
+ img.Header.Flags |= image.IMAGE_F_ENCRYPTED
+
return img, nil
}