[PATCH 1/4] public keys: make error message more informative

Sascha Hauer s.hauer at pengutronix.de
Wed May 27 03:54:41 PDT 2026


When adding a key to a keyring fails because a key with the same name hint
already exists, print which keyring and which hint is duplicate. This also
removes the string "fit" from the error message which seems to be a remnant
of days when only FIT images used keys.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 crypto/public-keys.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/public-keys.c b/crypto/public-keys.c
index a2d31f4bc2..ecf255bbb4 100644
--- a/crypto/public-keys.c
+++ b/crypto/public-keys.c
@@ -29,7 +29,8 @@ int public_key_add(struct public_key *key)
 	}
 
 	if (public_key_get(key->key_name_hint, key->keyring)) {
-		pr_warn("Aborting addition of public key: Duplicate fit name hint\n");
+		pr_warn("Cannot add key: key_name_hint %s already exists in keyring %s\n",
+			key->key_name_hint, key->keyring);
 		return -EEXIST;
 	}
 

-- 
2.47.3




More information about the barebox mailing list