Experimental support for pkcs#11#5
Experimental support for pkcs#11#5junkmejl63 wants to merge 8 commits intonxp-imx-support:masterfrom
Conversation
Use nxp-cst-signer with pkcs11 tokens
|
can we provide also the way we can modify the cfg file once we select pkcs#11? |
src/cst_signer.c
Outdated
| fprintf(fp_csf_file, "\tSource = \"%s/crts/%s\"\n", g_cst_path, rvalue); | ||
|
|
||
| } else { // use PKCS#11 | ||
| DEBUG("PKCS11:\n"); |
There was a problem hiding this comment.
This line results in a syntax error because the VA_ARGS is empty, leading to an extra comma before the closing parenthesis.
I get following error trying to compile this PR:
| In file included from cst_signer.c:9:
| cst_signer.c: In function ‘create_csf_file_v3’:
| ../inc/cst_signer.h:67:107: error: expected expression before ‘)’ token
| 67 | printf("%s:%s:%d: " fmt, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); \
| | ^
| cst_signer.c:552:17: note: in expansion of macro ‘DEBUG’
| 552 | DEBUG("PKCS11:\n");
| | ^~~~~
Following change to the macro fixes my problem:
--- a/inc/cst_signer.h
+++ b/inc/cst_signer.h
@@ -64,7 +64,7 @@ const char* desc_opt[] =
#define DEBUG(fmt, ...) do { \
if (1 == g_debug) { \
- printf("%s:%s:%d: " fmt, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); \
+ printf("%s:%s:%d: " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
There was a problem hiding this comment.
Fixed it, I must have added between testing and comitting (I'm not an expert on git).
Also added some details on how to find the pkcs#11 url, and an example (that must be changed), on PKCS#11 URL in the cfg.
Added some more details on pkcs#11 and csf example file. Fixed a typo in the debug() statement.
Three changes - When adding pkcs#11, accidentially s swapped arguments, causing HAB4 images to not work - nxp-cst signer is sensitive if the cfg have empty "variable=\x0" on last line,as may cause segementation failure - nxp-cst-siger fails invokation of of cst, if the cfg file contains CRLF.
|
Thank you for the contribution. As we cannot accept the PR directly, we will make this change and commit acknowledging the PR. |
| - The solution protects the private key from exposure of normal usage. | ||
|
|
||
| PKCS#11 is expeimental support is added for linux, append --pkcs11 | ||
| In order for this to work, PKCS11_MODULE_PATH must be set before invoking |
There was a problem hiding this comment.
We will reword this description. CST does have HSM docker environment to experiment with this feature, so would refer to it as well.
There was a problem hiding this comment.
Quite still experimental, still working on it, have also made some adjustment for it to work with i.MX8MN and i.MX8MP.
Docker make and standalone make, places binaries on different places.
Support pkcs11: keys for csf and img signing on hab4.
…r cst hab and spsdk ahab Merge in IMXS/cst-signer from feature/MICRSE-3703-imx-signer-add-pkcs11-backend-for-cst-hab-and-spsdk-ahab to master * commit '1c477bda6e2625cae88832212a2457868002b6cb': [MICRSE-3703] Create build_pkcs11_uri routine for the pkcs11 string and Support for NOCAK Fast Authentication Applying Suggestion, env_result, replacing conditions about the pkcs11 token Applying suggestion. The parse method is looking for an extact string. Fix format and adding .gitignore [MICRSE-3703] Updating Pull Request Requirements MICRSE-3703: PCKS11 Support for HAB, with/wihtout token and usr pin definition PCKS11 Implementation withe img file. PKCS11 Support for CSF Complete TODO: Working to create a function that implements this routine PCKS11 Implementation defining token in the csf file PKCS11 Token support. - CSF config file is looking for the token in the csfk_file and img_file - Adding -b pkcs11 extra param - TODO Implement a new strncpy and avoid overwrite --verbose command Adding verify routing if there is a Interact Token for the image0
Use nxp-cst-signer with cst, and sign images using pkcs11 tokens