You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2021/08/19 10:00:40 UTC
[mynewt-artifact] branch master updated: added HasEncryptionPayload
function to check for possible HW encryption
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-artifact.git
The following commit(s) were added to refs/heads/master by this push:
new 56555f5 added HasEncryptionPayload function to check for possible HW encryption
56555f5 is described below
commit 56555f5f45008ce9f277a4c51c3d5593734752d1
Author: Mark Blake <40...@users.noreply.github.com>
AuthorDate: Mon Aug 16 12:32:21 2021 -0700
added HasEncryptionPayload function to check for possible HW encryption
---
image/image.go | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/image/image.go b/image/image.go
index d54eb82..4842cde 100644
--- a/image/image.go
+++ b/image/image.go
@@ -813,3 +813,27 @@ func (img *Image) Bin() ([]byte, error) {
return b.Bytes(), nil
}
+
+// HasEncryptionPayload indicates whether an image's contains a HW encryption payload.
+func (img *Image) HasEncryptionPayload() bool {
+ enc := false
+ res, _ := img.FindAllUniqueTlv(IMAGE_TLV_SECRET_ID_LEGACY)
+ if res != nil {
+ nonce, _ := img.FindAllUniqueTlv(IMAGE_TLV_AES_NONCE_LEGACY)
+ if nonce != nil {
+ enc = true
+ }
+
+ }
+ if !enc {
+ res, _ = img.FindAllUniqueTlv(IMAGE_TLV_SECRET_ID)
+ if res != nil {
+ nonce, _ := img.FindAllUniqueTlv(IMAGE_TLV_AES_NONCE)
+ if nonce != nil {
+ enc = true
+ }
+
+ }
+ }
+ return enc
+}