[Concept,03/19] bootctl: Set the password flag on the passphrase edit text

Message ID 20251208023229.3929910-4-sjg@u-boot.org
State New
Headers
Series bootctl: Continue development with TKey functionality |

Commit Message

Simon Glass Dec. 8, 2025, 2:32 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The SCENEOF_PASSWORD flag is set on the textline object, but the
rendering code checks the flag on the text object being rendered. Set
the flag on the edit text object so the passphrase renders as asterisks
instead of showing the actual characters.

Mark the textline object as hidden while we are here, so it disappears
when switching to the simple bootmenu.

Co-developed-by: Claude <claude@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 boot/bootflow_menu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 01af30c6627..1b740c8d16b 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -45,6 +45,7 @@  static int bootflow_menu_set_item_props(struct scene *scn,
 	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 + i, true);
 	scene_obj_set_hide(scn, ITEM_PASS_LABEL + i, true);
 	scene_obj_set_hide(scn, ITEM_PASS_EDIT + i, true);
 	if (ret)
@@ -233,6 +234,7 @@  int bootflow_menu_add(struct expo *exp, struct bootflow *bflow, int seq,
 {
 	struct menu_priv *priv = exp->priv;
 	struct scene_obj_textline *tline;
+	struct scene_obj_txt *txt;
 	char str[2], *key;
 	struct scene *scn;
 	uint preview_id;
@@ -308,10 +310,11 @@  int bootflow_menu_add(struct expo *exp, struct bootflow *bflow, int seq,
 
 	snprintf(name, sizeof(name), "item%d.pass.edit", seq);
 	ret = scene_txt_str(scn, name, ITEM_PASS_EDIT + seq, 0,
-			    abuf_data(&tline->buf), NULL);
+			    abuf_data(&tline->buf), &txt);
 	if (ret < 0)
 		return log_msg_ret("ite", -EINVAL);
 	tline->edit_id = ret;
+	txt->obj.flags |= SCENEOF_PASSWORD;
 
 	/* Create message text (hidden by default) for success/error feedback */
 	snprintf(name, sizeof(name), "item%d.pass_msg", seq);