Fix issues related to password
cover Fix issues related to password
Remove the trailing newline from passwords entered on the command line so that password-protected keys can be used.
Document that providing the password along with the -p option does not work since the provided password would become the file to sign.
Regards,
Stefan
Stefan Berger (2):
Strip trailing newline from password entered via prompt Add note that when -p is used password must not be provided
README | 1 + src/evmctl.c | 7 +++++++ 2 files changed, 8 insertions(+)
Signature · 1 line
2.39.2
PATCH 1/2 Strip trailing newline from password entered via prompt
The password entered via the prompt contains the trainling newline ('\n') and therefore likely none of the passwords used for keys are 'working', meaning using a password-protected key is likely to fail when using the prompt. Therefore, remove the trailing newline from the password.
--- src/evmctl.c | 6 ++++++ 1 file changed, 6 insertions(+)
src/evmctl.c +6 -0
@@ -2936,6 +2936,7 @@ static char *get_password(void)struct termios flags, tmp_flags;char *password, *pwd;int passlen =64 ; +size_t actlen; password =malloc (passlen);if (!password) {
@@ -2969,6 +2970,11 @@ static char *get_password(void)return NULL ; } +/* strip trailing '\n' */ + actlen =strlen (password); +if (actlen >0 && password[actlen -1 ] =='\n' ) + password[actlen -1 ] =0 ; +return password; }
Signature · 1 line
2.39.2
PATCH 2/2 Add note that when -p is used password must not be provided
In reply to Stefan BergerAdd a note to the -p option description in the help screen stating that a password must not be provided on the command line in this case since it will be ignored and become the name of the file to sign.
--- README | 1 + src/evmctl.c | 1 + 2 files changed, 2 insertions(+)
README +1 -0
@@ -60,6 +60,7 @@ OPTIONS read keyid value from SKID of a x509 cert file -o, --portable generate portable EVM signatures -p, --pass password for encrypted signing key + Do not provide password on command line when using -p -r, --recursive recurse into directories (sign) -t, --type file types to fix 'fxm' (f: file) x - skip fixing if both ima and evm xattrs exist (use with caution)
src/evmctl.c +1 -0
@@ -2834,6 +2834,7 @@ static void usage(void)" read keyid value from SKID of a x509 cert file\n" " -o, --portable generate portable EVM signatures\n" " -p, --pass password for encrypted signing key\n" +" Do not provide password on command line when using -p\n" " -r, --recursive recurse into directories (sign)\n" " -t, --type file types to fix 'fxm' (f: file)\n" " x - skip fixing if both ima and evm xattrs exist (use with caution)\n"
Signature · 1 line
2.39.2