!fsutils/passwd: Replace TEA with PBKDF2-HMAC-SHA256

Migrate passwd encrypt/verify to PBKDF2 modular crypt format using
kernel cryptodev (CRYPTO_PBKDF2_HMAC_SHA256 via /dev/crypto).  Add
passwd_pbkdf2 wrapper, base64url helpers, complexity validation, and
pbkdf2_test for RFC 6070 vector coverage.  FSUTILS_PASSWD selects
CRYPTO, ALLOW_BSD_COMPONENTS, and CRYPTO_CRYPTODEV so existing sim
defconfigs keep building.  Change NSH_LOGIN_USERNAME default to root and
remove fixed-login password defaults.

BREAKING CHANGE: TEA-encoded /etc/passwd entries no longer verify.
Regenerate each entry after upgrading.  Pair with the nuttx host mkpasswd
changes in apache/nuttx#19209.  Boards must enable the appropriate
software or hardware crypto backend for PBKDF2 at runtime.  When
CONFIG_NSH_LOGIN_FIXED=y, set CONFIG_NSH_LOGIN_PASSWORD in the board
defconfig or menuconfig; there is no default password.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
This commit is contained in:
Abhishek Mishra 2026-06-25 16:55:03 +00:00 committed by Xiang Xiao
parent 01c6a60581
commit 608f13fd4b
22 changed files with 1096 additions and 226 deletions

View file

@ -1287,17 +1287,20 @@ endchoice # Verification method
config NSH_LOGIN_USERNAME
string "Login username"
default "admin"
default "root"
depends on !NSH_LOGIN_PASSWD
---help---
Login user name. Default: "admin"
Login user name. Default: "root"
config NSH_LOGIN_PASSWORD
string "Login password"
default "Administrator"
depends on !NSH_LOGIN_PASSWD
depends on NSH_LOGIN_FIXED
---help---
Login password: Default: "Administrator"
The plaintext login password used when fixed username/password
verification is selected (CONFIG_NSH_LOGIN_FIXED). There is no
default; set CONFIG_NSH_LOGIN_PASSWORD in the board defconfig,
via menuconfig, or enter it when prompted during an interactive
build.
config NSH_LOGIN_FAILDELAY
int "Login failure delay"

View file

@ -266,8 +266,9 @@
* If CONFIG_NSH_TELNET_LOGIN is defined, then these additional
* options may be specified:
*
* CONFIG_NSH_LOGIN_USERNAME - Login user name. Default: "admin"
* CONFIG_NSH_LOGIN_PASSWORD - Login password: Default: "Administrator"
* CONFIG_NSH_LOGIN_USERNAME - Login user name. Default: "root"
* CONFIG_NSH_LOGIN_PASSWORD - Login password (required when using fixed
* credentials; no default is provided).
* CONFIG_NSH_LOGIN_FAILCOUNT - Number of login retry attempts.
* Default 3.
*/
@ -275,11 +276,7 @@
#ifdef CONFIG_NSH_TELNET_LOGIN
# ifndef CONFIG_NSH_LOGIN_USERNAME
# define CONFIG_NSH_LOGIN_USERNAME "admin"
# endif
# ifndef CONFIG_NSH_LOGIN_PASSWORD
# define CONFIG_NSH_LOGIN_PASSWORD "nuttx"
# define CONFIG_NSH_LOGIN_USERNAME "root"
# endif
# ifndef CONFIG_NSH_LOGIN_FAILCOUNT