mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
tests: Avoid hardcoding 64b arch path to pkcs11-spy
Find the path to the library using cmake and enable this sort of logging only with TORTURE_PKCS11 environment variable. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
committed by
Sahana Prasad
parent
81f9b00005
commit
fcd63abb6a
@@ -187,6 +187,10 @@ if (CLIENT_TESTING OR SERVER_TESTING)
|
||||
if (NOT SOFTHSM_FOUND)
|
||||
message(SEND_ERROR "Could not find softhsm module!")
|
||||
endif (NOT SOFTHSM_FOUND)
|
||||
find_library(PKCS11SPY
|
||||
NAMES
|
||||
pkcs11-spy.so
|
||||
)
|
||||
if (WITH_PKCS11_PROVIDER)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
|
||||
@@ -69,3 +69,4 @@
|
||||
#cmakedefine TIMEOUT_EXECUTABLE "${TIMEOUT_EXECUTABLE}"
|
||||
#cmakedefine SOFTHSM2_LIBRARY "${SOFTHSM2_LIBRARY}"
|
||||
#cmakedefine P11_KIT_CLIENT "${P11_KIT_CLIENT}"
|
||||
#cmakedefine PKCS11SPY "${PKCS11SPY}"
|
||||
|
||||
@@ -1207,6 +1207,7 @@ void torture_setup_tokens(const char *temp_dir,
|
||||
char token_setup_start_cmd[1024] = {0};
|
||||
char socket_path[1204] = {0};
|
||||
char conf_path[1024] = {0};
|
||||
char *env = NULL;
|
||||
int rc;
|
||||
|
||||
rc = snprintf(token_setup_start_cmd,
|
||||
@@ -1239,9 +1240,19 @@ void torture_setup_tokens(const char *temp_dir,
|
||||
|
||||
setenv("PKCS11_PROVIDER_MODULE", P11_KIT_CLIENT, 1);
|
||||
/* This is useful for debugging PKCS#11 calls */
|
||||
setenv("PKCS11SPY", P11_KIT_CLIENT, 1);
|
||||
setenv("PKCS11_PROVIDER_MODULE", "/usr/lib64/pkcs11-spy.so", 1);
|
||||
|
||||
env = getenv("TORTURE_PKCS11");
|
||||
if (env != NULL && env[0] != '\0') {
|
||||
#ifdef PKCS11SPY
|
||||
setenv("PKCS11SPY", P11_KIT_CLIENT, 1);
|
||||
setenv("PKCS11_PROVIDER_MODULE", PKCS11SPY, 1);
|
||||
#else
|
||||
fprintf(stderr, "[ TORTURE ] >>> pkcs11-spy not found\n");
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
(void)env;
|
||||
|
||||
snprintf(conf_path, sizeof(conf_path), "%s/softhsm.conf", temp_dir);
|
||||
setenv("SOFTHSM2_CONF", conf_path, 1);
|
||||
#endif /* WITH_PKCS11_PROVIDER */
|
||||
|
||||
Reference in New Issue
Block a user