| bb3b0c0b | 16-Oct-2023 |
Sandrine Bailleux <sandrine.bailleux@arm.com> |
fix(cert-create): fix key loading logic
When key_load() attempts to load the key from a file and it fails to open this file, the 'err_code' output argument is set to 'KEY_ERR_OPEN' error code. Howev
fix(cert-create): fix key loading logic
When key_load() attempts to load the key from a file and it fails to open this file, the 'err_code' output argument is set to 'KEY_ERR_OPEN' error code. However, it is incorrectly overwritten later on with 'KEY_ERR_NONE' or 'KEY_ERR_LOAD'.
The latter case messes up with the key creation scenario. The 'KEY_ERR_LOAD' error leads the tool to exit, when it should attempt to create the said key file if invoked with the --new-keys/-n option.
Note that, to complicate matters further, which of 'KEY_ERR_OPEN' or 'KEY_ERR_NONE' values is returned by key_load() depends on the version of OpenSSL in use:
- If using v3+, KEY_ERROR_LOAD is returned.
- If using <v3, KEY_ERROR_NONE is returned as a result of the key pair container being initialized by key_new().
This patch fixes this bug and also takes the opportunity to refactor key_load() implementation to (hopefully) make it more straight-forward and easier to reason about.
Fixes: 616b3ce27d9a "feat(cert-create): add pkcs11 engine support" Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com> Reported-by: Wenchen Tan <xtaens@qq.com> Change-Id: Ia78ff442e04c5ff98e6ced8d26becbd817a8ccb7
show more ...
|
| 616b3ce2 | 12-Sep-2023 |
Robin van der Gracht <robin@protonic.nl> |
feat(cert-create): add pkcs11 engine support
Add pkcs11 engine support which allows using keys that are securely stored on a HSM or TPM. To use this feature the user has to supply an RFC 7512 compli
feat(cert-create): add pkcs11 engine support
Add pkcs11 engine support which allows using keys that are securely stored on a HSM or TPM. To use this feature the user has to supply an RFC 7512 compliant PKCS11 URI to a key instead of a file as an argument to one of the key options. This change is fully backwards compatible.
This change makes use of the openssl engine API which is deprecated since openssl 3.0 and will most likely be removed in version 4. So pkcs11 support will have to be updated to the openssl provider API in the near future.
Signed-off-by: Robin van der Gracht <robin@protonic.nl> Change-Id: If96725988ca62c5613ec59123943bf15922f5d1f
show more ...
|
| bcad2030 | 27-Jul-2020 |
Jimmy Brisson <jimmy.brisson@arm.com> |
Use preallocated parts of the HASH struct
When OpenSSL's macro allocates the HASH struct, it allocates the fields as well. After this allocation, the prior code would assign over the pointers inside
Use preallocated parts of the HASH struct
When OpenSSL's macro allocates the HASH struct, it allocates the fields as well. After this allocation, the prior code would assign over the pointers inside the HASH struct, leaking these fields. This patch avoids allocating extra copies of these members.
Change-Id: I50a38b0a04b52ec54d6388db0f694feb578d2818 Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
show more ...
|