add_library(libSceLibreSsl SHARED EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/Export.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Bignum.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Digest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Runtime.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Aes.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Error.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Ocsp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Stack.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Ui.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Rsa.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/X509StoreContext.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Pkey.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/EvpCipherCtx.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Evp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Ec.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/OcspResponse.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/EvpCipher.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/EvpAes.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/X509Name.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Ssl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SslCtx.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SslCtxCallbacks.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SslSession.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/PkeyLifecycle.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/UiString.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/X509.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/PkeyId.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Engine.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/PemX509.cpp)
target_include_directories(libSceLibreSsl PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(libSceLibreSsl PRIVATE mbedtls mbedx509 mbedcrypto)
if(MINGW OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
    target_link_options(libSceLibreSsl PRIVATE LINKER:--exclude-libs,ALL)
endif()
if(WIN32)
    target_link_libraries(libSceLibreSsl PRIVATE bcrypt ws2_32)
endif()
configure_windows_unwind(libSceLibreSsl)
include(${CMAKE_CURRENT_SOURCE_DIR}/LibreSslCrypto.cmake)
if(BUILD_TESTING)
    add_test_executable(guest_libre_ssl_des_answers_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslDesAnswers.cpp)
    target_include_directories(guest_libre_ssl_des_answers_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libre_ssl_des_answers_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libre_ssl_des_answers_tests)
    add_test(NAME guest_libre_ssl_des_answers COMMAND guest_libre_ssl_des_answers_tests)
    set_tests_properties(guest_libre_ssl_des_answers PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_libre_ssl_des_answers PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Asn1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/ExData.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/X509NamePrintEx.cpp)
target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/RsaKeygen.cpp)
target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/PemReadBioX509.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/PemPrivateKey.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_bn_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslBn.cpp)
    target_include_directories(guest_libressl_bn_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_bn_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_bn_tests)
    add_test(NAME guest_libressl_bn COMMAND guest_libressl_bn_tests)
    add_test(NAME guest_libressl_bn_allocator COMMAND guest_libressl_bn_tests --allocator)
    set_tests_properties(guest_libressl_bn guest_libressl_bn_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_bn guest_libressl_bn_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_x509_errors_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslX509Errors.cpp)
    target_include_directories(guest_libressl_x509_errors_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_errors_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_errors_tests)
    add_test(NAME guest_libressl_x509_errors COMMAND guest_libressl_x509_errors_tests)
    set_tests_properties(guest_libressl_x509_errors PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_errors PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_pkey_lifecycle_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslPkeyLifecycle.cpp)
    target_include_directories(guest_libressl_pkey_lifecycle_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_pkey_lifecycle_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_pkey_lifecycle_tests)
    add_test(NAME guest_libressl_pkey_lifecycle COMMAND guest_libressl_pkey_lifecycle_tests)
    set_tests_properties(guest_libressl_pkey_lifecycle PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_pkey_lifecycle PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_pkey_rsa_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslPkeyRsa.cpp)
    target_include_directories(guest_libressl_pkey_rsa_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_pkey_rsa_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_pkey_rsa_tests)
    add_test(NAME guest_libressl_pkey_rsa COMMAND guest_libressl_pkey_rsa_tests)
    set_tests_properties(guest_libressl_pkey_rsa PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_pkey_rsa PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_rsa_private_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslRsaPrivate.cpp)
    target_include_directories(guest_libressl_rsa_private_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_rsa_private_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_rsa_private_tests)
    add_test(NAME guest_libressl_rsa_private COMMAND guest_libressl_rsa_private_tests)
    set_tests_properties(guest_libressl_rsa_private PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_rsa_private PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_file_bio_ctrl_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslFileBioCtrl.cpp)
    target_include_directories(guest_libressl_file_bio_ctrl_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_file_bio_ctrl_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_file_bio_ctrl_tests)
    add_test(NAME guest_libressl_file_bio_ctrl COMMAND guest_libressl_file_bio_ctrl_tests)
    set_tests_properties(guest_libressl_file_bio_ctrl PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_file_bio_ctrl PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_rsa_error_queue_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslRsaErrorQueue.cpp)
    target_include_directories(guest_libressl_rsa_error_queue_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_rsa_error_queue_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_rsa_error_queue_tests)
    add_test(NAME guest_libressl_rsa_error_queue COMMAND guest_libressl_rsa_error_queue_tests)
    set_tests_properties(guest_libressl_rsa_error_queue PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_rsa_error_queue PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_rsa_sign_errors_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslRsaSignErrors.cpp)
    target_include_directories(guest_libressl_rsa_sign_errors_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_rsa_sign_errors_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_rsa_sign_errors_tests)
    add_test(NAME guest_libressl_rsa_sign_errors COMMAND guest_libressl_rsa_sign_errors_tests)
    set_tests_properties(guest_libressl_rsa_sign_errors PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_rsa_sign_errors PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_rsa_pss_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslRsaPss.cpp)
    target_include_directories(guest_libressl_rsa_pss_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_rsa_pss_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_rsa_pss_tests)
    add_test(NAME guest_libressl_rsa_pss COMMAND guest_libressl_rsa_pss_tests)
    set_tests_properties(guest_libressl_rsa_pss PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_rsa_pss PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_digest_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslDigest.cpp)
    target_include_directories(guest_libressl_digest_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_digest_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_digest_tests)
    add_test(NAME guest_libressl_digest COMMAND guest_libressl_digest_tests)
    set_tests_properties(guest_libressl_digest PROPERTIES TIMEOUT 30)
    add_test_executable(guest_libressl_certificate_asn1_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslCertificateAsn1.cpp)
    target_include_directories(guest_libressl_certificate_asn1_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_certificate_asn1_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_certificate_asn1_tests)
    add_test(NAME guest_libressl_certificate_asn1 COMMAND guest_libressl_certificate_asn1_tests)
    set_tests_properties(guest_libressl_certificate_asn1 PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_certificate_asn1 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_asn1_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Asn1.cpp)
    target_include_directories(guest_libressl_asn1_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_asn1_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_asn1_tests)
    add_test(NAME guest_libressl_asn1 COMMAND guest_libressl_asn1_tests)
    add_test(NAME guest_libressl_asn1_allocator COMMAND guest_libressl_asn1_tests allocator)
    set_tests_properties(guest_libressl_asn1 guest_libressl_asn1_allocator PROPERTIES TIMEOUT 30)
    add_test_executable(guest_libressl_ex_data_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ExData.cpp)
    target_include_directories(guest_libressl_ex_data_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ex_data_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ex_data_tests)
    add_test(NAME guest_libressl_ex_data COMMAND guest_libressl_ex_data_tests)
    set_tests_properties(guest_libressl_ex_data PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_digest guest_libressl_asn1 guest_libressl_asn1_allocator guest_libressl_ex_data PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
    add_test_executable(guest_libressl_ssl_bio_callback_control_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/SslBioCallbackControl.cpp)
    target_include_directories(guest_libressl_ssl_bio_callback_control_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_bio_callback_control_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ssl_bio_callback_control_tests)
    add_test(NAME guest_libressl_ssl_bio_callback_control COMMAND guest_libressl_ssl_bio_callback_control_tests)
    set_tests_properties(guest_libressl_ssl_bio_callback_control PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_bio_callback_control PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_des_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslDes.cpp)
    target_include_directories(guest_libressl_des_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_des_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_des_tests)
    add_test(NAME guest_libressl_des COMMAND guest_libressl_des_tests)
    set_tests_properties(guest_libressl_des PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_libressl_des PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_runtime_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslRuntime.cpp)
    target_include_directories(guest_libressl_runtime_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_runtime_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_runtime_tests)
    add_test(NAME guest_libressl_runtime COMMAND guest_libressl_runtime_tests)
    set_tests_properties(guest_libressl_runtime PROPERTIES TIMEOUT 30)

    add_test_executable(guest_libressl_pkey_id_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslPkeyId.cpp)
    target_include_directories(guest_libressl_pkey_id_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_pkey_id_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_pkey_id_tests)
    add_test(NAME guest_libressl_pkey_id COMMAND guest_libressl_pkey_id_tests)
    set_tests_properties(guest_libressl_pkey_id PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_runtime guest_libressl_pkey_id PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_aes_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslAes.cpp)
    target_include_directories(guest_libressl_aes_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_aes_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_aes_tests)
    add_test(NAME guest_libressl_aes COMMAND guest_libressl_aes_tests)
    set_tests_properties(guest_libressl_aes PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_aes PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libre_ssl_error_model_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslErrorModel.cpp)
    target_include_directories(guest_libre_ssl_error_model_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libre_ssl_error_model_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libre_ssl_error_model_tests)
    add_test(NAME guest_libre_ssl_error_model COMMAND guest_libre_ssl_error_model_tests)
    set_tests_properties(guest_libre_ssl_error_model PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_libre_ssl_error_model PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_error_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslError.cpp)
    target_include_directories(guest_libressl_error_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_error_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_error_tests)
    add_test(NAME guest_libressl_error COMMAND guest_libressl_error_tests)
    set_tests_properties(guest_libressl_error PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_error PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ocsp_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslOcsp.cpp)
    target_include_directories(guest_libressl_ocsp_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ocsp_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ocsp_tests)
    add_test(NAME guest_libressl_ocsp COMMAND guest_libressl_ocsp_tests)
    set_tests_properties(guest_libressl_ocsp PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ocsp PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_stack_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslStack.cpp)
    target_include_directories(guest_libressl_stack_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_stack_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_stack_tests)
    add_test(NAME guest_libressl_stack COMMAND guest_libressl_stack_tests)
    set_tests_properties(guest_libressl_stack PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_stack PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_general_name_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslGeneralName.cpp)
    target_include_directories(guest_libressl_general_name_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_general_name_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_general_name_tests)
    add_test(NAME guest_libressl_general_name COMMAND guest_libressl_general_name_tests)
    add_test(NAME guest_libressl_ocsp_response_free COMMAND guest_libressl_general_name_tests ocsp)
    set_tests_properties(guest_libressl_general_name guest_libressl_ocsp_response_free PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_general_name guest_libressl_ocsp_response_free PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ui_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslUi.cpp)
    target_include_directories(guest_libressl_ui_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ui_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ui_tests)
    add_test(NAME guest_libressl_ui COMMAND guest_libressl_ui_tests)
    set_tests_properties(guest_libressl_ui PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ui PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_rsa_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslRsa.cpp)
    target_include_directories(guest_libressl_rsa_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_rsa_tests PRIVATE libSceLibreSsl libc mbedcrypto)
    configure_windows_unwind(guest_libressl_rsa_tests)
    add_test(NAME guest_libressl_rsa COMMAND guest_libressl_rsa_tests)
    set_tests_properties(guest_libressl_rsa PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_rsa PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_x509_store_context_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslX509StoreContext.cpp)
    target_include_directories(guest_libressl_x509_store_context_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_store_context_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_store_context_tests)
    add_test(NAME guest_libressl_x509_store_context COMMAND guest_libressl_x509_store_context_tests)
    set_tests_properties(guest_libressl_x509_store_context PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_store_context PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
    add_test_executable(guest_libressl_pkey_type_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslPkeyType.cpp)
    target_include_directories(guest_libressl_pkey_type_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_pkey_type_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_pkey_type_tests)
    add_test(NAME guest_libressl_pkey_type COMMAND guest_libressl_pkey_type_tests)
    set_tests_properties(guest_libressl_pkey_type PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_pkey_type PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ssl_ctx_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslCtx.cpp)
    target_include_directories(guest_libressl_ssl_ctx_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_ctx_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ssl_ctx_tests)
    add_test(NAME guest_libressl_ssl_ctx COMMAND guest_libressl_ssl_ctx_tests)
    set_tests_properties(guest_libressl_ssl_ctx PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_ctx PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ssl_ctx_fields_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslCtxFields.cpp)
    target_include_directories(guest_libressl_ssl_ctx_fields_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_ctx_fields_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ssl_ctx_fields_tests)
    add_test(NAME guest_libressl_ssl_ctx_fields COMMAND guest_libressl_ssl_ctx_fields_tests)
    set_tests_properties(guest_libressl_ssl_ctx_fields PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_ctx_fields PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_evp_cipher_ctx_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEvpCipherCtx.cpp)
    target_include_directories(guest_libressl_evp_cipher_ctx_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_evp_cipher_ctx_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_evp_cipher_ctx_tests)
    add_test(NAME guest_libressl_evp_cipher_ctx COMMAND guest_libressl_evp_cipher_ctx_tests)
    set_tests_properties(guest_libressl_evp_cipher_ctx PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_evp_cipher_ctx PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_wycheproof_cbc_cmac_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/WycheproofCbcCmac.cpp)
    target_include_directories(guest_libressl_wycheproof_cbc_cmac_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_wycheproof_cbc_cmac_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_wycheproof_cbc_cmac_tests)
    add_test(NAME guest_libressl_wycheproof_cbc_cmac COMMAND guest_libressl_wycheproof_cbc_cmac_tests)
    set_tests_properties(guest_libressl_wycheproof_cbc_cmac PROPERTIES TIMEOUT 60)
    if(WIN32)
        set_tests_properties(guest_libressl_wycheproof_cbc_cmac PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_wycheproof_rsa_pkcs1_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/WycheproofRsaPkcs1.cpp)
    target_include_directories(guest_libressl_wycheproof_rsa_pkcs1_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_wycheproof_rsa_pkcs1_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_wycheproof_rsa_pkcs1_tests)
    add_test(NAME guest_libressl_wycheproof_rsa_pkcs1 COMMAND guest_libressl_wycheproof_rsa_pkcs1_tests)
    set_tests_properties(guest_libressl_wycheproof_rsa_pkcs1 PROPERTIES TIMEOUT 60)
    if(WIN32)
        set_tests_properties(guest_libressl_wycheproof_rsa_pkcs1 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_evp_aes_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEvpAes.cpp)
    target_include_directories(guest_libressl_evp_aes_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_evp_aes_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_evp_aes_tests)
    add_test(NAME guest_libressl_evp_aes COMMAND guest_libressl_evp_aes_tests)
    set_tests_properties(guest_libressl_evp_aes PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_evp_aes PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ec_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEc.cpp)
    target_include_directories(guest_libressl_ec_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ec_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ec_tests)
    add_test(NAME guest_libressl_ec COMMAND guest_libressl_ec_tests)
    set_tests_properties(guest_libressl_ec PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ec PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_evp_cipher_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEvpCipher.cpp)
    target_include_directories(guest_libressl_evp_cipher_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_evp_cipher_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_evp_cipher_tests)
    add_test(NAME guest_libressl_evp_cipher COMMAND guest_libressl_evp_cipher_tests)
    set_tests_properties(guest_libressl_evp_cipher PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_evp_cipher PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_x509_name_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslX509Name.cpp)
    target_include_directories(guest_libressl_x509_name_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_name_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_x509_name_tests)
    add_test(NAME guest_libressl_x509_name COMMAND guest_libressl_x509_name_tests)
    set_tests_properties(guest_libressl_x509_name PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_name PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ocsp_response_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslOcspResponse.cpp)
    target_include_directories(guest_libressl_ocsp_response_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ocsp_response_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ocsp_response_tests)
    add_test(NAME guest_libressl_ocsp_response COMMAND guest_libressl_ocsp_response_tests)
    set_tests_properties(guest_libressl_ocsp_response PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ocsp_response PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ocsp_response_decode_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslOcspResponseDecode.cpp)
    target_include_directories(guest_libressl_ocsp_response_decode_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ocsp_response_decode_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ocsp_response_decode_tests)
    add_test(NAME guest_libressl_ocsp_response_decode COMMAND guest_libressl_ocsp_response_decode_tests)
    set_tests_properties(guest_libressl_ocsp_response_decode PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ocsp_response_decode PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ocsp_basic_response_decode_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslOcspBasicResponseDecode.cpp)
    target_include_directories(guest_libressl_ocsp_basic_response_decode_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ocsp_basic_response_decode_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ocsp_basic_response_decode_tests)
    add_test(NAME guest_libressl_ocsp_basic_response_decode COMMAND guest_libressl_ocsp_basic_response_decode_tests)
    set_tests_properties(guest_libressl_ocsp_basic_response_decode PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ocsp_basic_response_decode PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_x509v3_print_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslX509V3Print.cpp)
    target_include_directories(guest_libressl_x509v3_print_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509v3_print_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509v3_print_tests)
    add_test(NAME guest_libressl_x509v3_print COMMAND guest_libressl_x509v3_print_tests)
    set_tests_properties(guest_libressl_x509v3_print PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509v3_print PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_x509_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslX509.cpp)
    target_include_directories(guest_libressl_x509_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_x509_tests)
    add_test(NAME guest_libressl_x509 COMMAND guest_libressl_x509_tests)
    set_tests_properties(guest_libressl_x509 PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ui_string_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslUiString.cpp)
    target_include_directories(guest_libressl_ui_string_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ui_string_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ui_string_tests)
    add_test(NAME guest_libressl_ui_string COMMAND guest_libressl_ui_string_tests)
    set_tests_properties(guest_libressl_ui_string PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ui_string PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ssl_ctx_callbacks_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslCtxCallbacks.cpp)
    target_include_directories(guest_libressl_ssl_ctx_callbacks_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_ctx_callbacks_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ssl_ctx_callbacks_tests)
    add_test(NAME guest_libressl_ssl_ctx_callbacks COMMAND guest_libressl_ssl_ctx_callbacks_tests)
    set_tests_properties(guest_libressl_ssl_ctx_callbacks PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_ctx_callbacks PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ssl_session_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslSession.cpp)
    target_include_directories(guest_libressl_ssl_session_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_session_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ssl_session_tests)
    add_test(NAME guest_libressl_ssl_session COMMAND guest_libressl_ssl_session_tests)
    set_tests_properties(guest_libressl_ssl_session PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_session PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ec_keys_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEcKeys.cpp)
    target_include_directories(guest_libressl_ec_keys_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ec_keys_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ec_keys_tests)
    add_test(NAME guest_libressl_ec_keys COMMAND guest_libressl_ec_keys_tests)
    set_tests_properties(guest_libressl_ec_keys PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ec_keys PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ec_point_mul_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEcPointMul.cpp)
    target_include_directories(guest_libressl_ec_point_mul_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ec_point_mul_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ec_point_mul_tests)
    add_test(NAME guest_libressl_ec_point_mul COMMAND guest_libressl_ec_point_mul_tests)
    set_tests_properties(guest_libressl_ec_point_mul PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ec_point_mul PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()

    add_test_executable(guest_libressl_ec_error_queue_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEcErrorQueue.cpp)
    target_include_directories(guest_libressl_ec_error_queue_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ec_error_queue_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ec_error_queue_tests)
    add_test(NAME guest_libressl_ec_error_queue COMMAND guest_libressl_ec_error_queue_tests)
    set_tests_properties(guest_libressl_ec_error_queue PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ec_error_queue PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Cipher.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_digest_extents_tests ${LIBS_INCLUDE_DIR}/tests/GuestDigestExtents.cpp)
    target_include_directories(guest_digest_extents_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_digest_extents_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_digest_extents_tests)
    add_test(NAME guest_digest_extents COMMAND guest_digest_extents_tests)
    set_tests_properties(guest_digest_extents PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_digest_extents PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_cipher_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslCipher.cpp)
    target_include_directories(guest_libressl_cipher_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_cipher_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_cipher_tests)
    add_test(NAME guest_libressl_cipher COMMAND guest_libressl_cipher_tests)
    set_tests_properties(guest_libressl_cipher PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_cipher PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/CipherList.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_cipher_list_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CipherList.cpp)
    target_include_directories(guest_libressl_cipher_list_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_cipher_list_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_cipher_list_tests)
    add_test(NAME guest_libressl_cipher_list COMMAND guest_libressl_cipher_list_tests)
    add_test(NAME guest_libressl_cipher_list_allocator COMMAND guest_libressl_cipher_list_tests allocator)
    set_tests_properties(guest_libressl_cipher_list guest_libressl_cipher_list_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_cipher_list guest_libressl_cipher_list_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/OcspBasicResponse.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_ocsp_basic_response_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslOcspBasicResponse.cpp)
    target_include_directories(guest_libressl_ocsp_basic_response_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ocsp_basic_response_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ocsp_basic_response_tests)
    add_test(NAME guest_libressl_ocsp_basic_response COMMAND guest_libressl_ocsp_basic_response_tests)
    set_tests_properties(guest_libressl_ocsp_basic_response PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ocsp_basic_response PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Conf.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_conf_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Conf.cpp)
    target_include_directories(guest_libressl_conf_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_conf_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_conf_tests)
    add_test(NAME guest_libressl_conf COMMAND guest_libressl_conf_tests)
    add_test(NAME guest_libressl_conf_allocator COMMAND guest_libressl_conf_tests allocator)
    set_tests_properties(guest_libressl_conf guest_libressl_conf_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_conf guest_libressl_conf_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Alert.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_alert_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslAlert.cpp)
    target_include_directories(guest_libressl_alert_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_alert_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_alert_tests)
    add_test(NAME guest_libressl_alert COMMAND guest_libressl_alert_tests)
    set_tests_properties(guest_libressl_alert PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_alert PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_version_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslVersion.cpp)
    target_include_directories(guest_libressl_version_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_version_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_version_tests)
    add_test(NAME guest_libressl_version COMMAND guest_libressl_version_tests)
    set_tests_properties(guest_libressl_version PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_version PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_crypto_locks_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslCryptoLocks.cpp)
    target_include_directories(guest_libressl_crypto_locks_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_crypto_locks_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_crypto_locks_tests)
    add_test(NAME guest_libressl_crypto_locks COMMAND guest_libressl_crypto_locks_tests)
    set_tests_properties(guest_libressl_crypto_locks PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_libressl_crypto_locks PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ObjectTable.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/ObjectText.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/ObjectCreate.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_object_text_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ObjectText.cpp)
    target_include_directories(guest_libressl_object_text_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_object_text_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_object_text_tests)
    add_test(NAME guest_libressl_object_text COMMAND guest_libressl_object_text_tests)
    set_tests_properties(guest_libressl_object_text PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_object_text PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_object_name_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ObjectName.cpp)
    target_include_directories(guest_libressl_object_name_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_object_name_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_object_name_tests)
    add_test(NAME guest_libressl_object_name COMMAND guest_libressl_object_name_tests)
    set_tests_properties(guest_libressl_object_name PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_object_name PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_object_allocation_tests
        tests/ObjectTextAllocation.cpp src/ObjectText.cpp src/ObjectCreate.cpp src/ObjectTable.cpp src/Error.cpp)
    target_include_directories(guest_libressl_object_allocation_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_compile_features(guest_libressl_object_allocation_tests PRIVATE cxx_std_23)
    target_link_libraries(guest_libressl_object_allocation_tests PRIVATE libc)
    configure_windows_unwind(guest_libressl_object_allocation_tests)
    add_test(NAME guest_libressl_object_allocation COMMAND guest_libressl_object_allocation_tests)
    set_tests_properties(guest_libressl_object_allocation PROPERTIES TIMEOUT 8)
    if(WIN32)
        set_tests_properties(guest_libressl_object_allocation PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/X509Store.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_x509_store_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/X509Store.cpp)
    target_include_directories(guest_libressl_x509_store_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_store_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_store_tests)
    add_test(NAME guest_libressl_x509_store COMMAND guest_libressl_x509_store_tests)
    add_test(NAME guest_libressl_x509_store_allocator COMMAND guest_libressl_x509_store_tests allocator)
    set_tests_properties(guest_libressl_x509_store guest_libressl_x509_store_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_store guest_libressl_x509_store_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/X509VerifyParam.cpp)
target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/GeneralName.cpp)
target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/OcspResponseDer.cpp)
target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/OcspBasicResponseDer.cpp)
target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/X509V3Print.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_x509_verify_param_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/X509VerifyParam.cpp)
    target_include_directories(guest_libressl_x509_verify_param_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_verify_param_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_verify_param_tests)
    add_test(NAME guest_libressl_x509_verify_param COMMAND guest_libressl_x509_verify_param_tests)
    add_test(NAME guest_libressl_x509_verify_param_allocator COMMAND guest_libressl_x509_verify_param_tests allocator)
    set_tests_properties(guest_libressl_x509_verify_param guest_libressl_x509_verify_param_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_verify_param guest_libressl_x509_verify_param_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING AND ANYPS5_LIBRESSL_ORACLE)
    include(ExternalProject)
    set(libressl_reference_build "${CMAKE_BINARY_DIR}/libressl-reference-build")
    set(libressl_reference_timestamp)
    if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
        set(libressl_reference_timestamp DOWNLOAD_EXTRACT_TIMESTAMP ON)
    endif()
    ExternalProject_Add(libressl_reference
        URL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.5.4.tar.gz
        URL_HASH SHA256=107a5b522fbb8318d4c3be668075e5e607296f0a9255d71674caa94571336efa
        ${libressl_reference_timestamp}
        PREFIX "${CMAKE_BINARY_DIR}/libressl-reference"
        BINARY_DIR "${libressl_reference_build}"
        CMAKE_ARGS
            -DCMAKE_BUILD_TYPE=Release
            -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
            -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
            -DCMAKE_POLICY_VERSION_MINIMUM=3.5
            "-DCMAKE_C_FLAGS=-D_GNU_SOURCE -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -Wno-error=implicit-int"
        BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target crypto ssl
        INSTALL_COMMAND ""
        BUILD_BYPRODUCTS "${libressl_reference_build}/crypto/libcrypto.a" "${libressl_reference_build}/ssl/libssl.a")
    ExternalProject_Get_Property(libressl_reference SOURCE_DIR)
    add_test_executable(guest_libressl_oracle_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Oracle.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tests/OracleReference.cpp)
    add_dependencies(guest_libressl_oracle_tests libressl_reference)
    set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/tests/OracleReference.cpp PROPERTIES
        INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
        COMPILE_DEFINITIONS "WIN32_LEAN_AND_MEAN;NOCRYPT")
    target_include_directories(guest_libressl_oracle_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_oracle_tests PRIVATE libSceLibreSsl libSceLibreSsl3 libc
        "${libressl_reference_build}/ssl/libssl.a" "${libressl_reference_build}/crypto/libcrypto.a")
    if(WIN32)
        target_link_libraries(guest_libressl_oracle_tests PRIVATE ws2_32)
    endif()
    configure_windows_unwind(guest_libressl_oracle_tests)
    add_test(NAME guest_libressl_oracle COMMAND guest_libressl_oracle_tests)
    set_tests_properties(guest_libressl_oracle PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_oracle PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_x509_lookup_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/X509Lookup.cpp)
    target_include_directories(guest_libressl_x509_lookup_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_lookup_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_lookup_tests)
    add_test(NAME guest_libressl_x509_lookup COMMAND guest_libressl_x509_lookup_tests)
    add_test(NAME guest_libressl_x509_lookup_allocator COMMAND guest_libressl_x509_lookup_tests allocator)
    set_tests_properties(guest_libressl_x509_lookup guest_libressl_x509_lookup_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_lookup guest_libressl_x509_lookup_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/TlsEngine.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_tls_engine_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/TlsEngine.cpp)
    target_include_directories(guest_libressl_tls_engine_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_tls_engine_tests PRIVATE libSceLibreSsl libkernel libc mbedx509)
    configure_windows_unwind(guest_libressl_tls_engine_tests)
    set(tls_engine_tests)
    foreach(group handshake data transport)
        add_test(NAME guest_libressl_tls_engine_${group} COMMAND guest_libressl_tls_engine_tests ${group})
        list(APPEND tls_engine_tests guest_libressl_tls_engine_${group})
    endforeach()
    set_tests_properties(${tls_engine_tests} PROPERTIES TIMEOUT 30)
    if(WIN32)
        target_link_libraries(guest_libressl_tls_engine_tests PRIVATE ws2_32)
        set_tests_properties(${tls_engine_tests} PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/SslMethod.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SslBio.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SslLifecycle.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SslIo.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_ssl_lifecycle_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslLifecycle.cpp)
    target_include_directories(guest_libressl_ssl_lifecycle_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_lifecycle_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_ssl_lifecycle_tests)
    add_test(NAME guest_libressl_ssl_lifecycle COMMAND guest_libressl_ssl_lifecycle_tests)
    set_tests_properties(guest_libressl_ssl_lifecycle PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_lifecycle PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_ssl_io_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslIo.cpp)
    target_include_directories(guest_libressl_ssl_io_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_io_tests PRIVATE libSceLibreSsl libkernel libc)
    configure_windows_unwind(guest_libressl_ssl_io_tests)
    set(ssl_io_tests)
    foreach(group handshake data shutdown transport)
        add_test(NAME guest_libressl_ssl_io_${group} COMMAND guest_libressl_ssl_io_tests ${group})
        list(APPEND ssl_io_tests guest_libressl_ssl_io_${group})
    endforeach()
    set_tests_properties(${ssl_io_tests} PROPERTIES TIMEOUT 30)
    if(WIN32)
        target_link_libraries(guest_libressl_ssl_io_tests PRIVATE ws2_32)
        set_tests_properties(${ssl_io_tests} PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_x509_extension_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslX509Extension.cpp)
    target_include_directories(guest_libressl_x509_extension_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_extension_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_extension_tests)
    add_test(NAME guest_libressl_x509_extension COMMAND guest_libressl_x509_extension_tests)
    set_tests_properties(guest_libressl_x509_extension PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_extension PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_evp_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslEvp.cpp)
    target_include_directories(guest_libressl_evp_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_evp_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_evp_tests)
    add_test(NAME guest_libressl_evp COMMAND guest_libressl_evp_tests)
    set_tests_properties(guest_libressl_evp PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_evp PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_ssl_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSsl.cpp)
    target_include_directories(guest_libressl_ssl_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ssl_tests)
    add_test(NAME guest_libressl_ssl COMMAND guest_libressl_ssl_tests)
    set_tests_properties(guest_libressl_ssl PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_ssl_settings_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibreSslSslSettings.cpp)
    target_include_directories(guest_libressl_ssl_settings_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_ssl_settings_tests PRIVATE libSceLibreSsl)
    configure_windows_unwind(guest_libressl_ssl_settings_tests)
    add_test(NAME guest_libressl_ssl_settings COMMAND guest_libressl_ssl_settings_tests)
    set_tests_properties(guest_libressl_ssl_settings PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_ssl_settings PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/X509NameOneline.cpp)

target_sources(libSceLibreSsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/DigestVerify.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_libressl_digest_verify_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/DigestVerify.cpp)
    target_include_directories(guest_libressl_digest_verify_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_digest_verify_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_digest_verify_tests)
    add_test(NAME guest_libressl_digest_verify COMMAND guest_libressl_digest_verify_tests)
    add_test(NAME guest_libressl_digest_verify_allocator COMMAND guest_libressl_digest_verify_tests allocator)
    set_tests_properties(guest_libressl_digest_verify guest_libressl_digest_verify_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_digest_verify guest_libressl_digest_verify_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_x509_name_oneline_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/X509NameOneline.cpp)
    target_include_directories(guest_libressl_x509_name_oneline_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_name_oneline_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_name_oneline_tests)
    add_test(NAME guest_libressl_x509_name_oneline COMMAND guest_libressl_x509_name_oneline_tests)
    add_test(NAME guest_libressl_x509_name_oneline_allocator COMMAND guest_libressl_x509_name_oneline_tests allocator)
    set_tests_properties(guest_libressl_x509_name_oneline guest_libressl_x509_name_oneline_allocator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_name_oneline guest_libressl_x509_name_oneline_allocator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_libressl_x509_name_print_ex_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/X509NamePrintEx.cpp)
    target_include_directories(guest_libressl_x509_name_print_ex_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_libressl_x509_name_print_ex_tests PRIVATE libSceLibreSsl libc)
    configure_windows_unwind(guest_libressl_x509_name_print_ex_tests)
    add_test(NAME guest_libressl_x509_name_print_ex COMMAND guest_libressl_x509_name_print_ex_tests)
    set_tests_properties(guest_libressl_x509_name_print_ex PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_libressl_x509_name_print_ex PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibreSsl>")
    endif()
endif()
