Dear GRUB2 Maintainers,

 

I have submitted a patch  titled "lib-crypto-Add-character-echo-for-passwprd-input.path" which

addresses the issue of adding character echo functionality during password input in GRUB2.

 

This change aims to improve user experience by providing visual feedback when typing passwords.

The changes include:
- Implementation of character echo ('*') during password entry.
- Ensuring compatibility with existing functionalities.

 

Could you kindly review the proposed changes at your earliest convenience?

Any feedback or suggestions for improvement would be greatly appreciated.

Thank you very much for your time and consideration.

Best regards,
[andy lau]

[https://github.com/AndyLau-SOC]

---------------------------------------------------------------------------------------------------

From: Andy Lau <liuyan...@kylinos.cn>
Date: Mon, 26 May 2025 15:53:28 +0800
Subject: [PATCH] lib/crypto: Add character echo for password input

 

Implements character echo (e.g., '*') for user password input in GRUB. Currently,
there is no visual feedback during password entry, making it difficult for users
to confirm their input. This change significantly improves the user experience.

 

 

Signed-off-by: Andy Lau <liuyan...@kylinos.cn>
---
grub-core/lib/crypto.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
index 396f76410..4506e7c10 100644
--- a/grub-core/lib/crypto.c
+++ b/grub-core/lib/crypto.c
@@ -471,7 +471,10 @@ grub_password_get (char buf[], unsigned buf_size)
if (key == '\b')
{
if (cur_len)
- cur_len--;
+ {
+ cur_len--;
+ grub_printf ("\b \b");
+ }
continue;
}

@@ -479,7 +482,10 @@ grub_password_get (char buf[], unsigned buf_size)
continue;

if (cur_len + 2 < buf_size)
- buf[cur_len++] = key;
+ {
+ buf[cur_len++] = key;
+ grub_printf ("*");
+ }
}

grub_memset (buf + cur_len, 0, buf_size - cur_len);
--
2.34.1

----

-------------------------------------------------------------------------------------------------------------

 

Test when entering grub2's menuentry on the x86_64 or aarch64 platform

 

 If you think my patch is reasonable and effective, please integrate it into grub2.

Thank you.

 

 

 

 

 

Attachment: lib-crypto-Add-character-echo-for-password-input.patch
Description: Binary data

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to