mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-09 15:41:10 +03:00
The engine API in OpenSSL 3.0 is deprecated so we are in the progress of working on a PKCS#11 provider for OpenSSL. This commit introduces a conditional build with the pkcs11-provider support (instead of engines) with all the changes required for the provider to work with existing code and tests. The CI modification is only temporary before we will have the real package in Fedora or somewhere to use. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com>
124 lines
3.2 KiB
CMake
124 lines
3.2 KiB
CMake
project(unittests C)
|
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
torture_buffer
|
|
torture_bytearray
|
|
torture_callbacks
|
|
torture_crypto
|
|
torture_init
|
|
torture_list
|
|
torture_misc
|
|
torture_config
|
|
torture_options
|
|
torture_isipaddr
|
|
torture_knownhosts_parsing
|
|
torture_hashes
|
|
torture_packet_filter
|
|
torture_temp_dir
|
|
torture_temp_file
|
|
torture_push_pop_dir
|
|
torture_session_keys
|
|
torture_tokens
|
|
)
|
|
|
|
set(LIBSSH_THREAD_UNIT_TESTS
|
|
torture_rand
|
|
torture_threads_init
|
|
torture_threads_buffer
|
|
torture_threads_crypto
|
|
)
|
|
|
|
set(TORTURE_UNIT_ENVIRONMENT
|
|
"LSAN_OPTIONS=suppressions=${libssh-tests_SOURCE_DIR}/suppressions/lsan.supp;")
|
|
if (OPENSSL_FOUND)
|
|
list(APPEND TORTURE_UNIT_ENVIRONMENT OPENSSL_ENABLE_SHA1_SIGNATURES=1)
|
|
endif (OPENSSL_FOUND)
|
|
|
|
if (UNIX AND NOT WIN32)
|
|
set(LIBSSH_UNIT_TESTS
|
|
${LIBSSH_UNIT_TESTS}
|
|
# this uses a socketpair
|
|
torture_packet
|
|
# requires ssh-keygen
|
|
torture_keyfiles
|
|
torture_pki
|
|
torture_pki_rsa
|
|
torture_pki_dsa
|
|
torture_pki_ed25519
|
|
# requires /dev/null
|
|
torture_channel
|
|
)
|
|
|
|
if (WITH_SERVER)
|
|
set(LIBSSH_UNIT_TESTS
|
|
${LIBSSH_UNIT_TESTS}
|
|
torture_bind_config)
|
|
|
|
if (WITH_GEX)
|
|
set(LIBSSH_UNIT_TESTS
|
|
${LIBSSH_UNIT_TESTS}
|
|
torture_moduli)
|
|
endif()
|
|
endif()
|
|
|
|
if (WITH_PKCS11_URI)
|
|
set(LIBSSH_UNIT_TESTS
|
|
${LIBSSH_UNIT_TESTS}
|
|
torture_pki_rsa_uri
|
|
torture_pki_ecdsa_uri
|
|
)
|
|
list(APPEND TORTURE_UNIT_ENVIRONMENT PKCS11_PROVIDER_DEBUG=file:/tmp/p11prov-debug.log)
|
|
endif()
|
|
|
|
if (HAVE_ECC)
|
|
set(LIBSSH_UNIT_TESTS
|
|
${LIBSSH_UNIT_TESTS}
|
|
torture_pki_ecdsa
|
|
)
|
|
endif()
|
|
|
|
set(LIBSSH_THREAD_UNIT_TESTS
|
|
${LIBSSH_THREAD_UNIT_TESTS}
|
|
# requires pthread
|
|
torture_threads_pki_rsa
|
|
)
|
|
if (WITH_SERVER)
|
|
# Not working correctly
|
|
# add_cmocka_test(torture_server_x11 torture_server_x11.c ${TEST_TARGET_LIBRARIES})
|
|
# the signals are not testable under cmocka
|
|
# set(LIBSSH_THREAD_UNIT_TESTS
|
|
# ${LIBSSH_THREAD_UNIT_TESTS}
|
|
# torture_unit_server
|
|
# )
|
|
endif (WITH_SERVER)
|
|
endif (UNIX AND NOT WIN32)
|
|
|
|
foreach(_UNIT_TEST ${LIBSSH_UNIT_TESTS})
|
|
add_cmocka_test(${_UNIT_TEST}
|
|
SOURCES ${_UNIT_TEST}.c
|
|
COMPILE_OPTIONS ${DEFAULT_C_COMPILE_FLAGS}
|
|
LINK_LIBRARIES ${TEST_TARGET_LIBRARIES}
|
|
)
|
|
|
|
set_property(TEST ${_UNIT_TEST}
|
|
PROPERTY
|
|
ENVIRONMENT ${TORTURE_UNIT_ENVIRONMENT})
|
|
endforeach()
|
|
|
|
if (CMAKE_USE_PTHREADS_INIT)
|
|
foreach(_UNIT_TEST ${LIBSSH_THREAD_UNIT_TESTS})
|
|
add_cmocka_test(${_UNIT_TEST}
|
|
SOURCES ${_UNIT_TEST}.c
|
|
COMPILE_OPTIONS ${DEFAULT_C_COMPILE_FLAGS}
|
|
LINK_LIBRARIES ${TEST_TARGET_LIBRARIES} Threads::Threads
|
|
)
|
|
|
|
set_property(TEST ${_UNIT_TEST}
|
|
PROPERTY
|
|
ENVIRONMENT ${TORTURE_UNIT_ENVIRONMENT})
|
|
endforeach()
|
|
endif ()
|
|
|