All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshul Dalal <anshuld@ti.com>
To: <meta-arago@lists.yoctoproject.org>
Cc: Anshul Dalal <anshuld@ti.com>, <vigneshr@ti.com>,
	<denys@konsulko.com>, <reatmon@ti.com>
Subject: [meta-arago][scarthgap][PATCH RFC 4/4] swupdate: enable authentication for update image
Date: Tue, 2 Dec 2025 16:46:01 +0530	[thread overview]
Message-ID: <20251202111603.1616989-5-anshuld@ti.com> (raw)
In-Reply-To: <20251202111603.1616989-1-anshuld@ti.com>

To ensure the platform can only be updated from an authorised source,
this patch adds signing to the .swu update image using the pre-existing
custMpk keys from ti-secdev.

Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
 .../recipes-swupdate/images/files/sw-description             | 2 ++
 meta-arago-distro/recipes-swupdate/images/update-image.bb    | 4 ++++
 meta-arago-distro/recipes-swupdate/swupdate/files/defconfig  | 1 +
 .../recipes-swupdate/swupdate/files/swupdate.sh              | 2 +-
 .../recipes-swupdate/swupdate/swupdate_%.bbappend            | 5 +++++
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
index 241bc95c..8a7e5f4d 100644
--- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
+++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
@@ -13,6 +13,7 @@ software =
 						device = "/dev/mmcblk0p1";
 						type = "raw";
 						compressed = "zlib";
+						sha256 = "$swupdate_get_sha256(@@IMAGE_BASENAME@@-@@MACHINE@@.rootfs.ext4.gz)";
 					},
 				);
 				uboot: (
@@ -30,6 +31,7 @@ software =
 						device = "/dev/mmcblk0p2";
 						type = "raw";
 						compressed = "zlib";
+						sha256 = "$swupdate_get_sha256(@@IMAGE_BASENAME@@-@@MACHINE@@.rootfs.ext4.gz)";
 					},
 				);
 				uboot: (
diff --git a/meta-arago-distro/recipes-swupdate/images/update-image.bb b/meta-arago-distro/recipes-swupdate/images/update-image.bb
index 33b0b74c..6176e5a6 100644
--- a/meta-arago-distro/recipes-swupdate/images/update-image.bb
+++ b/meta-arago-distro/recipes-swupdate/images/update-image.bb
@@ -1,4 +1,5 @@
 inherit swupdate
+inherit ti-secdev
 
 IMAGE_BASENAME ?= "tisdk-default-image"
 
@@ -21,3 +22,6 @@ SWUPDATE_IMAGES_FSTYPES[tisdk-bootstrap-image] = ".rootfs.ext4.gz"
 SWUPDATE_IMAGES_FSTYPES[tisdk-jailhouse-image] = ".rootfs.ext4.gz"
 SWUPDATE_IMAGES_FSTYPES[tisdk-thinlinux-image] = ".rootfs.ext4.gz"
 SWUPDATE_IMAGES_FSTYPES[tisdk-bootstrap-base-image] = ".rootfs.ext4.gz"
+
+SWUPDATE_SIGNING = "RSA"
+SWUPDATE_PRIVATE_KEY = "${TI_SECURE_DEV_PKG}/keys/custMpk.key"
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
index 4a2d78c0..0bf605f7 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
@@ -4,6 +4,7 @@ CONFIG_HW_COMPATIBILITY=y
 CONFIG_UBOOT=y
 CONFIG_SYSTEMD=y
 CONFIG_WEBSERVER=y
+CONFIG_SIGNED_IMAGES=y
 CONFIG_BOOTLOADERHANDLER=y
 CONFIG_CFI=y
 CONFIG_EMMC_HANDLER=y
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
index 2083062e..fc32e4cf 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
@@ -12,4 +12,4 @@ fi
 UBOOT_BOOTCOUNT_ADDR=0x4301c100
 
 devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
-swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
+swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080" -k /etc/custMpk.pub
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
index 20f87435..bff44926 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
+++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
@@ -1,4 +1,5 @@
 inherit swupdate-lib
+inherit ti-secdev
 
 FILESEXTRAPATHS:append := "${THISDIR}/files:"
 
@@ -8,6 +9,8 @@ FILES:${PN} += " \
   ${SWUPDATE_HW_COMPATIBILITY_FILE} \
 "
 
+DEPENDS += "openssl-native"
+
 SRC_URI += " \
     file://defconfig \
     file://swupdate.sh \
@@ -27,4 +30,6 @@ do_install:append () {
   install -d ${D}${sysconfdir}
   install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}
   sed -i "s#@MACHINE@#${MACHINE}#g" ${D}${sysconfdir}/swupdate.cfg
+
+  openssl rsa -in ${TI_SECURE_DEV_PKG}/keys/custMpk.key -pubout -out ${D}/etc/custMpk.pub
 }
-- 
2.52.0



  parent reply	other threads:[~2025-12-02 11:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 2/4] swupdate: add creation of update image Anshul Dalal
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support Anshul Dalal
2025-12-02 19:23   ` Andrew Davis
2025-12-03 10:16     ` Anshul Dalal
2025-12-03  5:58   ` Yogesh Hegde
2025-12-03 10:23     ` Anshul Dalal
2025-12-02 11:16 ` Anshul Dalal [this message]
2025-12-02 20:59 ` [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Denys Dmytriyenko
2025-12-03 14:07   ` Raghavendra, Vignesh
2026-05-29 12:33 ` Romain Naour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251202111603.1616989-5-anshuld@ti.com \
    --to=anshuld@ti.com \
    --cc=denys@konsulko.com \
    --cc=meta-arago@lists.yoctoproject.org \
    --cc=reatmon@ti.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.