[PATCH] rsa: use pkcs11 uri as defined in rfc7512

Ayoub Zaki ayoub.zaki at embetrix.com
Sat Aug 26 13:53:29 CEST 2023


pkcs11 : change engine uri to use full pk11-URI as defined in:

https://www.rfc-editor.org/rfc/rfc7512.html
Signed-off-by: Ayoub Zaki <ayoub.zaki at embetrix.com>
---
 doc/uImage.FIT/signature.txt |  2 +-
 lib/rsa/rsa-sign.c           | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/uImage.FIT/signature.txt b/doc/uImage.FIT/signature.txt
index c71280b63b..2ff0db3f98 100644
--- a/doc/uImage.FIT/signature.txt
+++ b/doc/uImage.FIT/signature.txt
@@ -681,7 +681,7 @@ $ ./tools/mkimage -f fit-image.its fitImage
 Sign the fitImage with the hardware key:
 
 $ ./tools/mkimage -F -k \
-"model=PKCS%2315%20emulated;manufacturer=ZeitControl;serial=000xxxxxxxxx;token=OpenPGP%20card%20%28User%20PIN%20%28sig%29%29" \
+"pkcs11:model=PKCS%2315%20emulated;manufacturer=ZeitControl;serial=000xxxxxxxxx;token=OpenPGP%20card%20%28User%20PIN%20%28sig%29%29" \
 -K u-boot.dtb -N pkcs11 -r fitImage
 
 
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index d20bdb58a5..7ae163f264 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -116,15 +116,15 @@ static int rsa_engine_get_pub_key(const char *keydir, const char *name,
 		if (keydir)
 			if (strstr(keydir, "object="))
 				snprintf(key_id, sizeof(key_id),
-					 "pkcs11:%s;type=public",
+					 "%s;type=public",
 					 keydir);
 			else
 				snprintf(key_id, sizeof(key_id),
-					 "pkcs11:%s;object=%s;type=public",
+					 "%s;object=%s;type=public",
 					 keydir, name);
 		else
 			snprintf(key_id, sizeof(key_id),
-				 "pkcs11:object=%s;type=public",
+				 "object=%s;type=public",
 				 name);
 	} else if (engine_id) {
 		if (keydir)
@@ -238,15 +238,15 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name,
 		if (keydir)
 			if (strstr(keydir, "object="))
 				snprintf(key_id, sizeof(key_id),
-					 "pkcs11:%s;type=private",
+					 "%s;type=private",
 					 keydir);
 			else
 				snprintf(key_id, sizeof(key_id),
-					 "pkcs11:%s;object=%s;type=private",
+					 "%s;object=%s;type=private",
 					 keydir, name);
 		else
 			snprintf(key_id, sizeof(key_id),
-				 "pkcs11:object=%s;type=private",
+				 "object=%s;type=private",
 				 name);
 	} else if (engine_id) {
 		if (keydir && name)
-- 
2.34.1



More information about the U-Boot mailing list