mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/6] keytoc: return error on failure to set PKCS#11 pin
Date: Wed,  9 Oct 2024 16:01:52 +0200	[thread overview]
Message-ID: <20241009140155.1990882-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241009140155.1990882-1-a.fatoum@pengutronix.de>

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@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




  parent reply	other threads:[~2024-10-09 14:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 14:01 [PATCH 0/6] crypto: ecdsa: fix fallout Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 1/6] crypto: reorder ECDSA Kconfig entries Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 2/6] crypto: rsa: support RSA keys with CONFIG_CRYPTO_BUILTIN_KEYS disabled Ahmad Fatoum
2024-10-09 14:01 ` Ahmad Fatoum [this message]
2024-10-09 14:01 ` [PATCH 4/6] crypto: ecdsa: make crypto/ecdsa.h header self-containing Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 5/6] test: self: jwt: regenerate jwt_test.pem.c_shipped Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 6/6] test: self: rename REGENERATE_RSATOC to REGNERATE_KEYTOC Ahmad Fatoum
2024-10-14 11:31 ` [PATCH 0/6] crypto: ecdsa: fix fallout Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241009140155.1990882-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox