From patchwork Sat Nov 15 18:51:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 703 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=1763232795; bh=OB9ouwfy/20713Vv+dVIYGqhs6Ze4RWGAd1sXjXW8h0=; 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=riTn13yfb4ONKkVt9FyC5oD3MU6wrTi1TpclDeoU2DE9wh179jRcFiVpvddS8tQ7R /vHG033iOZU2ibUCLVl0DyfBiQ/+gY7tq7e/F8tCENvnkXOcGlbwRp8xpHuP98tnqn OiLpYsQQqgGuct6Unun/lXtVbQ2Sgr8w/pEp+JM5IZA/hYcx9UXdrv7wQl1ABNasKI WY4p3VK/JtH8ql8x2GRTMP1i3yorGoeXO8F24zYmGwMKV1lMr9pso6YX8MqB6UMt1R MumYT8YdC6rKZyEN/U3bVgKXGAXNNVbQ4ICIcXIiTt5GCj17zxS2NXwnSlM2l/oU8o ablhp+P/4yHIw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DDD9A6861E for ; Sat, 15 Nov 2025 11:53:15 -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 jd5BRmmPQjex for ; Sat, 15 Nov 2025 11:53:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232793; bh=OB9ouwfy/20713Vv+dVIYGqhs6Ze4RWGAd1sXjXW8h0=; 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=Pn7KIBvT+f+MEmY26wz5tGf1UwSBYtWwcMfcXI81cAzWkYvixrr9diTAz+TKMcxIo tI17qSkm7xHm5hFT/8DSt2YQlG4HxNTOOlJQB1+ZXmr5rPOVmoBcRmI9ubg8Y4hjtR lfqbHQXZkpgu+0wufu/q4Jl9hNQr+DqnJnaABjukCQA0N6NS8J6EPQlhENMoWP8CyM HxwDTS8YVUbCDAqgxnvAQWagdW6JHrb3DeMDqbNVfCHWBtnD8mSXo3+QfYO80cZBhj ie6BQfBbQArW38r85DGc/g+e91pWHXvO6OPY4x+hYr2fHM4tdCfhBFIOnV9Zs87zqm sM1SpPsIe8NJQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C0BD466654 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=fiEZsp35N67NynPCEjRzR4GmDUqBTfrLqVi4fWiVrmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ubw/S7m2DCOqbWHucaIKsb94KcTAbPIP19upgN6e8FhK2yPxHKBNKnq1yvj3FsMcY AfQnWSHtRoKZQ08sj8xzarAWZfKa9JQVgj//P0pncYCecpy8wbvx7QtYRzZNRvL0Y2 8dbcLOVpiwftW9Pk/tfYX/muq9+pwdKoqka783PRbF4FCIqxRSk/zdaDhrK5LgmrZQ SjEhP/MwT0zA+7tMnijhWDGRAQtdaGg1iP3sTz0ybEp7/lgJdVTwvgXL0b7K/jcXsA G9ozk09b5KXr/Rg4Hzo/wFAdXMIFOVInet5zVarlPrZLbfVsFsWDuqPusloT/7l10X So0xLyAeyZ38w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 53FF368614; 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 CyribLThAyA6; 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=1763232786; bh=mtJ7aQHXEVPJIT5/yxJcUlF3+jdn8tptW31Hr7Sy7sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wH1Dfx0R72kquRV/eBebSY0ub8FuP2bAyxsdYQu1rpMaX2mNIM2Jy+aq11Qu5fzOX g9jIYmOITgHs9EnwhViRo9sY8w5+lpeuqKtCh3eAcM4cvTA1U4jt9oJ/fVWlJfT0ag Hiib7BYJVZjCGMGRfwPTGRnIphfXokLUpaecQLPK8dpCsbeoBT/yD7MvxUP1h4Wlxs z0SMKd6WJTEgqQG07uOEBGvYjAEncx9IU6YL3vSEZxJkuMfiqVUq+aB95Zqy1yq7fu +aGfZYzDR5zsPdHnLeXm8Ufn6LqzZC+jUuF76wQd8rtWNNNW2NM0SZDnMlzlzOwNE6 7eEpdVHFOE0yg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CF13A68570; Sat, 15 Nov 2025 11:53:05 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 15 Nov 2025 11:51:53 -0700 Message-ID: <20251115185212.539268-5-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: RPUPEFMHWKWC7W4NURJBAWF4LOHQ47QF X-Message-ID-Hash: RPUPEFMHWKWC7W4NURJBAWF4LOHQ47QF 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/16] expo: Support hiding password entry 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 Some fields may have sensitive information. Allow it to be obscured during entry, in case someone is watching the display nearby. Signed-off-by: Simon Glass --- boot/scene.c | 19 +++++++++++++++++-- include/expo.h | 2 ++ test/boot/cedit.c | 11 +++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index c2d106738f5..77926bda5fa 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -573,6 +573,19 @@ static void scene_render_background(struct scene_obj *obj, bool box_only, } } +static void draw_string(struct udevice *cons, const char *str, int len, + bool password) +{ + if (password) { + int i; + + for (i = 0; i < len; i++) + vidconsole_put_char(cons, '*'); + } else { + vidconsole_put_stringn(cons, str, len); + } +} + static int scene_txt_render(struct expo *exp, struct udevice *dev, struct udevice *cons, struct scene_obj *obj, struct scene_txt_generic *gen, int x, int y, @@ -630,7 +643,8 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev, if (!mline) { vidconsole_set_cursor_pos(cons, x, y); - vidconsole_put_string(cons, str); + draw_string(cons, str, strlen(str), + obj->flags & SCENEOF_PASSWORD); } alist_for_each(mline, &gen->lines) { @@ -648,7 +662,8 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev, if (y > bbox.y1) break; /* clip this line and any following */ vidconsole_set_cursor_pos(cons, x, y); - vidconsole_put_stringn(cons, str + mline->start, mline->len); + draw_string(cons, str + mline->start, mline->len, + obj->flags & SCENEOF_PASSWORD); } if (obj->flags & SCENEOF_POINT) vidconsole_pop_colour(cons, &old); diff --git a/include/expo.h b/include/expo.h index 2f32ff0aa72..e6093769421 100644 --- a/include/expo.h +++ b/include/expo.h @@ -320,6 +320,7 @@ enum scene_obj_align { * @SCENEOF_SYNC_BBOX: object's bounding box has changed * @SCENEOF_MANUAL: manually arrange the items associated with this object * @SCENEOF_DIRTY: object has been modified and needs to be redrawn + * @SCENEOF_PASSWORD: textline input should show stars instead of characters * @SCENEOF_LAST: used just as a check for the size of the flags mask */ enum scene_obj_flags_t { @@ -333,6 +334,7 @@ enum scene_obj_flags_t { SCENEOF_SYNC_BBOX = BIT(7), SCENEOF_MANUAL = BIT(8), SCENEOF_DIRTY = BIT(9), + SCENEOF_PASSWORD = BIT(10), SCENEOF_LAST, /* check for size of flags below */ }; diff --git a/test/boot/cedit.c b/test/boot/cedit.c index bccc93f8926..041da445459 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -376,6 +376,7 @@ static int cedit_render_lineedit(struct unit_test_state *uts) extern struct expo *cur_exp; struct expo_action evt; struct expo_action act; + struct scene_obj *edit; struct udevice *dev, *con; struct stdio_dev *sdev; struct scene *scn; @@ -405,6 +406,16 @@ static int cedit_render_lineedit(struct unit_test_state *uts) ut_asserteq(5344, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); + edit = scene_obj_find(scn, ID_MACHINE_NAME_EDIT, SCENEOBJT_TEXT); + ut_assert(edit); + + /* try the password flag */ + edit->flags |= SCENEOF_PASSWORD; + ut_assertok(expo_render(exp)); + ut_asserteq(5135, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + edit->flags &= ~SCENEOF_PASSWORD; + /* move to the line-edit field */ act.type = EXPOACT_POINT_OBJ; act.select.id = ID_MACHINE_NAME;