You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ag...@apache.org on 2020/11/11 20:03:17 UTC

[mynewt-core] branch master updated: hw/mcu/dialog: Support updated TLV values for booting

This is an automated email from the ASF dual-hosted git repository.

agross pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 097d684  hw/mcu/dialog: Support updated TLV values for booting
     new 5a8171e  Merge pull request #2398 from agross-korg/tlv-update
097d684 is described below

commit 097d68478622ebf4259187fd61ae15443650a4c2
Author: Andy Gross <an...@juul.com>
AuthorDate: Wed Oct 21 12:14:42 2020 -0500

    hw/mcu/dialog: Support updated TLV values for booting
    
    This patch adds handling of both legacy values and updated values for the
    IMAGE_TLV_AES_NONCE and IMAGE_TLV_SECRET_ID TLVs.  The reason for the change
    is to avoid overlapping TLV usage with upstream mcuboot.
    
    Signed-off-by: Andy Gross <an...@juul.com>
---
 hw/mcu/dialog/da1469x/src/hal_system_start.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/mcu/dialog/da1469x/src/hal_system_start.c b/hw/mcu/dialog/da1469x/src/hal_system_start.c
index bd24650..62f00fe 100644
--- a/hw/mcu/dialog/da1469x/src/hal_system_start.c
+++ b/hw/mcu/dialog/da1469x/src/hal_system_start.c
@@ -75,8 +75,10 @@ hal_system_restart(void *img_start)
 }
 
 #if MYNEWT_VAL(BOOT_CUSTOM_START) && MCUBOOT_MYNEWT
-#define IMAGE_TLV_AES_NONCE   0x50
-#define IMAGE_TLV_SECRET_ID   0x60
+#define IMAGE_TLV_AES_NONCE_LEGACY   0x50
+#define IMAGE_TLV_SECRET_ID_LEGACY   0x60
+#define IMAGE_TLV_AES_NONCE   0xa1
+#define IMAGE_TLV_SECRET_ID   0xa2
 
 sec_text_ram_core void
 boot_custom_start(uintptr_t flash_base, struct boot_rsp *rsp)
@@ -117,7 +119,8 @@ boot_custom_start(uintptr_t flash_base, struct boot_rsp *rsp)
             break;
         }
 
-        if (type == IMAGE_TLV_AES_NONCE) {
+        if ((type == IMAGE_TLV_AES_NONCE) ||
+            (type == IMAGE_TLV_AES_NONCE_LEGACY)) {
             assert(len == 8);
 
             rc = flash_area_read(fap, off, buf, len);
@@ -126,7 +129,8 @@ boot_custom_start(uintptr_t flash_base, struct boot_rsp *rsp)
             nonce[0] = __builtin_bswap32(*(uint32_t *)buf);
             nonce[1] = __builtin_bswap32(*(uint32_t *)(buf + 4));
             has_aes_nonce = true;
-        } else if (type == IMAGE_TLV_SECRET_ID) {
+        } else if ((type == IMAGE_TLV_SECRET_ID) ||
+                   (type == IMAGE_TLV_SECRET_ID_LEGACY)) {
             assert(len == 4);
 
             rc = flash_area_read(fap, off, buf, len);