mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
Cleanup the loaded pkcs11 provider
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 62762bbbc9)
This commit is contained in:
@@ -46,7 +46,6 @@
|
||||
#include <openssl/param_build.h>
|
||||
#if defined(WITH_PKCS11_URI) && defined(WITH_PKCS11_PROVIDER)
|
||||
#include <openssl/store.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
#endif /* OPENSSL_VERSION_NUMBER */
|
||||
|
||||
@@ -2719,9 +2718,6 @@ error:
|
||||
}
|
||||
|
||||
#ifdef WITH_PKCS11_URI
|
||||
#ifdef WITH_PKCS11_PROVIDER
|
||||
static bool pkcs11_provider_failed = false;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -2787,19 +2783,10 @@ int pki_uri_import(const char *uri_name,
|
||||
|
||||
/* The provider can be either configured in openssl.cnf or dynamically
|
||||
* loaded, assuming it does not need any special configuration */
|
||||
if (OSSL_PROVIDER_available(NULL, "pkcs11") == 0 &&
|
||||
!pkcs11_provider_failed) {
|
||||
OSSL_PROVIDER *pkcs11_provider = NULL;
|
||||
|
||||
pkcs11_provider = OSSL_PROVIDER_try_load(NULL, "pkcs11", 1);
|
||||
if (pkcs11_provider == NULL) {
|
||||
SSH_LOG(SSH_LOG_TRACE,
|
||||
"Failed to initialize provider: %s",
|
||||
ERR_error_string(ERR_get_error(), NULL));
|
||||
/* Do not attempt to load it again */
|
||||
pkcs11_provider_failed = true;
|
||||
goto fail;
|
||||
}
|
||||
rv = pki_load_pkcs11_provider();
|
||||
if (rv != SSH_OK) {
|
||||
SSH_LOG(SSH_LOG_TRACE, "Failed to load or initialize pkcs11 provider");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
store = OSSL_STORE_open(uri_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user