mkimage ECDSA signer looks for '<keydir>/<name>.pem' while the RSA
signer reads '<keydir>/<name>.key'. Both are PEM-encoded private keys
so the difference is not motivated by anything and was never documented.
This leaves anyone applying RSA habits to ECDSA with a confusing
"Can not get key file" error.

Signed-off-by: Ayoub Zaki <[email protected]>
---
 lib/ecdsa/ecdsa-libcrypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ecdsa/ecdsa-libcrypto.c b/lib/ecdsa/ecdsa-libcrypto.c
index c4bfb2cec61..ef3e42cb0f8 100644
--- a/lib/ecdsa/ecdsa-libcrypto.c
+++ b/lib/ecdsa/ecdsa-libcrypto.c
@@ -338,7 +338,7 @@ static int prepare_ctx(struct signer *ctx, const struct 
image_sign_info *info)
        } else if (info->keyfile) {
                snprintf(kname,  sizeof(kname), "%s", info->keyfile);
        } else if (info->keydir && info->keyname) {
-               snprintf(kname, sizeof(kname), "%s/%s.pem", info->keydir,
+               snprintf(kname, sizeof(kname), "%s/%s.key", info->keydir,
                         info->keyname);
        } else {
                fprintf(stderr, "keyfile, keyname, or key-name-hint missing\n");
-- 
2.43.0

Reply via email to