mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 18:14:24 +00:00
fix(cert-create): load openSSL configuration before PKCS11 operations
On some version of openSSL (1.1.1 or 1.1.0), OPENSSL_init_crypto() called by ENGINE_load_builtin_engines() will not automatically load the configuration. Fix this behavior by calling OPENSSL_init_crypto with OPENSSL_INIT_LOAD_CONFIG as a parameter. Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Change-Id: I2e4c0d646e540d039e9c72fd7814384b17de6dd5
This commit is contained in:
parent
dc5d485206
commit
785c2c3e86
1 changed files with 8 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <openssl/engine.h>
|
#include <openssl/engine.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
#include "cert.h"
|
#include "cert.h"
|
||||||
#include "cmd_opt.h"
|
#include "cmd_opt.h"
|
||||||
|
@ -214,6 +215,13 @@ static EVP_PKEY *key_load_pkcs11(const char *uri)
|
||||||
EVP_PKEY *pkey;
|
EVP_PKEY *pkey;
|
||||||
ENGINE *e;
|
ENGINE *e;
|
||||||
|
|
||||||
|
#if !USING_OPENSSL3
|
||||||
|
if (!OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL)) {
|
||||||
|
fprintf(stderr, "Failed to init SSL\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ENGINE_load_builtin_engines();
|
ENGINE_load_builtin_engines();
|
||||||
e = ENGINE_by_id("pkcs11");
|
e = ENGINE_by_id("pkcs11");
|
||||||
if (!e) {
|
if (!e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue