From patchwork Sat Nov 15 18:51:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 702 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232793; bh=ZYn0uNrdlxPa7DfouW+SnXrNGkJIgF5dJx5yuAkHM5o=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ejZG+klNs6w9hYXx4N+2/GSkBBtOpAxAxh5riqMyF/PusluFaexXzH6jtonTj+pe0 tkLCAskeni43icrUzl6b5Yq2V93FLRGzIdka6MN3qh3sQNLEF/gbs0BYETza8U8IaL Z5a/yOUKFdm+YFkPrCFL9vUoFeV4jJ8xt4yqYqAEQ3VC93tZFbWjjT6h16C6wtIMed 5ilWby1E07Xd0ig33LxGlAWioiyt8/RQX4PD3gPgcdJsqCm3wRBPVRcP0vQ7xFg0RO 9BqeGOsTiXV7Vt6LeS4XBhHZBDPQbmVYyuDWMhGTzJLl2177cruceI5zRiwNH0hQef I6mpmjc54qxbg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 699896861A for ; Sat, 15 Nov 2025 11:53:13 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id fypEliKAm-aF for ; Sat, 15 Nov 2025 11:53:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232793; bh=ZYn0uNrdlxPa7DfouW+SnXrNGkJIgF5dJx5yuAkHM5o=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ejZG+klNs6w9hYXx4N+2/GSkBBtOpAxAxh5riqMyF/PusluFaexXzH6jtonTj+pe0 tkLCAskeni43icrUzl6b5Yq2V93FLRGzIdka6MN3qh3sQNLEF/gbs0BYETza8U8IaL Z5a/yOUKFdm+YFkPrCFL9vUoFeV4jJ8xt4yqYqAEQ3VC93tZFbWjjT6h16C6wtIMed 5ilWby1E07Xd0ig33LxGlAWioiyt8/RQX4PD3gPgcdJsqCm3wRBPVRcP0vQ7xFg0RO 9BqeGOsTiXV7Vt6LeS4XBhHZBDPQbmVYyuDWMhGTzJLl2177cruceI5zRiwNH0hQef I6mpmjc54qxbg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 59251685B1 for ; Sat, 15 Nov 2025 11:53:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232791; bh=EsptldYBts01Q1nEDVi+lQvKrYzTdC0Ly+ECcN+VrG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aTkWRJWnnwglnjKU5V4up9LuFrHghZ1ZxZj72N4xmSmozUUX06v/FuXdzD3o5hnQT QlMl48zSYCn4SudonxLZP/Y1XWk6jFAQPDeA+QA9N8T1hYMH2i5xHEmaiO0ZJyuIZS UHkuxgvgESfBd+GmwC7n/U+m6eBOfnOr8vyDdQ8scsyVs2PmSnMsgSeVjEgxH1YU4B qzKa8uXEsRUqT5i9Jsw07RXE96EcsTspIieHAH0Chzl+aGYXOkHMa8ONK5Ga78k0gg 5IVBY3ifyT0k4UHlCfFTn76mxhWkoxAC+NACCrF2sfuRuEK4vP8ur5OeLXKJrJIqWq QOOFU8jw2o76w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 540B76861A; Sat, 15 Nov 2025 11:53:11 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id gNSjr4MeQOb4; Sat, 15 Nov 2025 11:53:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232790; bh=U25VB+OFyiIhLAIQKGo9U/hJK/lNcyamqe4DoXT6ZhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wUBIbDWhjCEjbcZOAsQ4LScFMM+ygb771ZejJLkdvPAJtDO78gltcfjBQNw6Ia5qA XXAvyZhx7D0wr2ut+KOVFWchjVa6esCa6FAFAnH7ekh4JxJ5S6oHVqU9ldOvfek43a LIDEIlHmS8JglFAlTatqqUHgXGObT11vrzRwc6eh4sFm8pA+sq2Z/qDeIaXPhoSnXK u5xYLYfGy72SqzRzNJt7oLDc7JEOYeyaV+iQzMN0B95vMmUDWMX/oeTm2pwpRCWQDM TfrWBOcKdcMOzfEjT0niisCoICDvywURF34m0CyuPM0LWXYHkZZ5dkGbJOCSknfpKF o2s9heruFQ1Ig== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1C05568521; Sat, 15 Nov 2025 11:53:10 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 15 Nov 2025 11:51:54 -0700 Message-ID: <20251115185212.539268-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251115185212.539268-1-sjg@u-boot.org> References: <20251115185212.539268-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: AODUWKBLDMPUG7I4YTW6DZIPBRZC3DOG X-Message-ID-Hash: AODUWKBLDMPUG7I4YTW6DZIPBRZC3DOG X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/16] expo: Support disk-passphrase entry in the menu List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Provide fields to show that a disk is locked and allow the user to enter a passphrase to unlock it. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/bootflow_internal.h | 11 +++++++++++ boot/bootflow_menu.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/boot/bootflow_internal.h b/boot/bootflow_internal.h index 519c3ee782a..b35700ba38f 100644 --- a/boot/bootflow_internal.h +++ b/boot/bootflow_internal.h @@ -26,6 +26,11 @@ * @ITEM_VERSION_NAME: Distro's name for the version, e.g. 'Noble Numbat' * @ITEM_BOX: Box around the item (normally hidden) * @ITEM_VERIFIED: Indicates that the item is verified by the vendor + * @ITEM_LOCKED: Indicates that the partition is encrypted (e.g., LUKS) + * @ITEM_PASS: Textline object for passphrase entry + * @ITEM_PASS_LABEL: Label text for the passphrase field (e.g., "Passphrase:") + * @ITEM_PASS_EDIT: Edit field for entering the passphrase + * @ITEM_PASS_MSG: Message text for displaying success/error feedback */ enum boomenu_id_t { START, @@ -37,6 +42,7 @@ enum boomenu_id_t { STR_AUTOBOOT, STR_MENU_TITLE, STR_POINTER, + STR_PASS_MSG, /* scene */ MAIN, @@ -70,6 +76,11 @@ enum boomenu_id_t { ITEM_VERSION_NAME = 1100, ITEM_BOX = 1200, ITEM_VERIFIED = 1300, + ITEM_LOCKED = 1400, + ITEM_PASS = 1500, + ITEM_PASS_LABEL = 1600, + ITEM_PASS_EDIT = 1700, + ITEM_PASS_MSG = 1800, /* left margin for the main menu */ MARGIN_LEFT = 100, diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index eda95428bf4..17fab284ef7 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -44,6 +44,9 @@ static int bootflow_menu_set_item_props(struct scene *scn, ret |= scene_obj_set_hide(scn, ITEM_VERSION_NAME + i, true); scene_obj_set_hide(scn, ITEM_VERIFIED + i, true); ret |= scene_obj_set_hide(scn, ITEM_KEY + i, false); + scene_obj_set_hide(scn, ITEM_LOCKED + i, true); + scene_obj_set_hide(scn, ITEM_PASS_LABEL + i, true); + scene_obj_set_hide(scn, ITEM_PASS_EDIT + i, true); if (ret) return log_msg_ret("msp", ret); @@ -229,6 +232,7 @@ int bootflow_menu_add(struct expo *exp, struct bootflow *bflow, int seq, struct scene **scnp) { struct menu_priv *priv = exp->priv; + struct scene_obj_textline *tline; char str[2], *key; struct scene *scn; uint preview_id; @@ -279,6 +283,33 @@ int bootflow_menu_add(struct expo *exp, struct bootflow *bflow, int seq, if (ret < 0) return log_msg_ret("itm", -EINVAL); + /* + * Create passphrase textline with label and edit field (12 chars). Show + * characters as asterisks + */ + ret = scene_textline(scn, "passphrase", ITEM_PASS + seq, 12, &tline); + if (ret < 0) + return log_msg_ret("itp", -EINVAL); + tline->obj.flags |= SCENEOF_PASSWORD; + ret = scene_txt_str(scn, "pass_label", ITEM_PASS_LABEL + seq, 0, + "Passphrase:", NULL); + if (ret < 0) + return log_msg_ret("itl", -EINVAL); + tline->label_id = ret; + + ret = scene_txt_str(scn, "pass_edit", ITEM_PASS_EDIT + seq, 0, + "", NULL); + if (ret < 0) + return log_msg_ret("ite", -EINVAL); + tline->edit_id = ret; + + /* Create message text (hidden by default) for success/error feedback */ + ret = scene_txt_str(scn, "pass_msg", ITEM_PASS_MSG + seq, + STR_PASS_MSG + seq, "", NULL); + if (ret < 0) + return log_msg_ret("ipm", -EINVAL); + scene_obj_set_hide(scn, ITEM_PASS_MSG + seq, true); + ret = bootflow_menu_set_item_props(scn, seq, bflow); if (ret) return log_msg_ret("itp", -EINVAL);