[PATCH 3/6] keytoc: return error on failure to set PKCS#11 pin

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Oct 9 07:01:52 PDT 2024


ret is used uninitialized when ENGINE_ctrl_cmd_string() fails.
Fix this by explicitly setting it to -1 to indicate an error.

Fixes: 128ad3cbe043 ("scripts: Add rsatoc tool")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 scripts/keytoc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/keytoc.c b/scripts/keytoc.c
index 5041c09a0e9f..d5c8aa2e1216 100644
--- a/scripts/keytoc.c
+++ b/scripts/keytoc.c
@@ -123,6 +123,7 @@ static int engine_init(ENGINE **pe)
 
 	if (key_pass) {
 		if (!ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0)) {
+			ret = -1;
 			fprintf(stderr, "Cannot set PKCS#11 PIN\n");
 			goto err_set_rsa;
 		}
-- 
2.39.5




More information about the barebox mailing list