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


The following commit(s) were added to refs/heads/master by this push:
     new f5de3f9  Set / clear "encrypt" flag in image header
     new 8098e32  Merge pull request #1 from ccollins476ad/encrypt-flag
f5de3f9 is described below

commit f5de3f98578364fbf50887818b02834f1b6f9238
Author: Christopher Collins <ccoll...@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
 }

Reply via email to