### Installation Rules Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/ssl/CMakeLists.txt Installs the defined targets (executables) into the 'bin' directory with specific file permissions. ```cmake install(TARGETS ${targets} DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Build mbed TLS and Examples Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/example-authcrypt/README.md Compile mbed TLS and associated examples. This may take a significant amount of time on the first run. ```bash yotta build ``` -------------------------------- ### Install Executables Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/aes/CMakeLists.txt Defines the installation rules for the project executables, setting the destination directory and file permissions. ```cmake install(TARGETS aescrypt2 crypt_and_hash DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install mbed TLS with Yotta Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/README.md Use this command to install the latest version of mbed TLS from the yotta registry. Ensure yotta is installed first. ```bash yotta install mbedtls ``` -------------------------------- ### Install Executables Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/pkey/CMakeLists.txt Installs the specified targets to the 'bin' directory with read, write, and execute permissions for the owner, and read and execute permissions for the group and world. ```cmake install(TARGETS dh_client dh_genprime dh_server key_app mpi_demo rsa_genkey rsa_sign rsa_verify rsa_encrypt rsa_decrypt pk_encrypt pk_decrypt pk_sign pk_verify gen_key DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Full Conversion Example with All Options Source: https://context7.com/tiliarou/4nxci/llms.txt Demonstrates a comprehensive conversion command using multiple options: specifying keyset, output directory, temporary directory, using game title for filename, and keeping original NCA IDs. ```bash ./4nxci -k keys.dat -o ./output -t ./temp -r --keepncaid game.xci ``` -------------------------------- ### Install Executable Targets Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/hash/CMakeLists.txt Installs specified executable targets to a destination directory with defined permissions. Ensure the destination path is appropriate for your system. ```cmake install(TARGETS hello generic_sum DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install Executables with Permissions Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/util/CMakeLists.txt Installs the strerror and pem2der executables into the 'bin' directory with specific file permissions for owner, group, and world. ```cmake install(TARGETS strerror pem2der DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Build mbedtls project Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/example-hashing/README.md Compiles the mbed TLS library and associated examples. ```bash $ yotta build ``` -------------------------------- ### Configure Build Dependencies and Targets Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/CMakeLists.txt Handles library installation paths, ZLIB support, and custom targets for documentation and testing. ```cmake if(CMAKE_BUILD_TYPE STREQUAL "Coverage") if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) set(CMAKE_SHARED_LINKER_FLAGS "--coverage") endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) endif(CMAKE_BUILD_TYPE STREQUAL "Coverage") if(LIB_INSTALL_DIR) else() set(LIB_INSTALL_DIR lib) endif() include_directories(include/) if(ENABLE_ZLIB_SUPPORT) find_package(ZLIB) if(ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIR}) endif(ZLIB_FOUND) endif(ENABLE_ZLIB_SUPPORT) add_subdirectory(library) add_subdirectory(include) if(ENABLE_PROGRAMS) add_subdirectory(programs) endif() ADD_CUSTOM_TARGET(apidoc COMMAND doxygen doxygen/mbedtls.doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) if(ENABLE_TESTING) enable_testing() add_subdirectory(tests) # additional convenience targets for Unix only if(UNIX) ADD_CUSTOM_TARGET(covtest COMMAND make test COMMAND programs/test/selftest COMMAND tests/compat.sh ``` -------------------------------- ### Keyset File Format Example Source: https://context7.com/tiliarou/4nxci/llms.txt An example INI-formatted keyset file required for NCA decryption. Place this file in the same directory as 4nxci or specify its location using the -k option. Includes required header and key area keys, as well as optional keys. ```ini # Required keys for 4NXCI operation # Place in same directory as 4nxci or specify with -k option # NCA Header Key (required) header_key = 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF # Application key area encryption keys (required) # xx = 00-1F for different key generations key_area_key_application_00 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_01 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_02 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_03 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_04 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_05 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_06 = 0123456789ABCDEF0123456789ABCDEF key_area_key_application_07 = 0123456789ABCDEF0123456789ABCDEF # Optional keys for additional functionality titlekek_00 = 0123456789ABCDEF0123456789ABCDEF master_key_00 = 0123456789ABCDEF0123456789ABCDEF ``` -------------------------------- ### Install mbed TLS Headers with CMake Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/include/CMakeLists.txt This snippet installs mbed TLS header files if the INSTALL_MBEDTLS_HEADERS option is enabled. It uses file globbing to find all .h files in the mbedtls directory and installs them to include/mbedtls. ```cmake option(INSTALL_MBEDTLS_HEADERS "Install mbed TLS headers." ON) if(INSTALL_MBEDTLS_HEADERS) file(GLOB headers "mbedtls/*.h") install(FILES ${headers} DESTINATION include/mbedtls PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) endif(INSTALL_MBEDTLS_HEADERS) ``` -------------------------------- ### Example Output Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/example-authcrypt/README.md The expected output from the authenticated encryption example, showing plaintext, ciphertext, and decrypted plaintext. The ciphertext will vary on each run due to random nonce generation. ```text {{timeout;10}} {{host_test_name;default}} {{description;mbed TLS example authcrypt}} {{test_id;MBEDTLS_EX_AUTHCRYPT}} {{start}} plaintext message: 536f6d65207468696e67732061726520626574746572206c65667420756e7265616400 ciphertext: c57f7afb94f14c7977d785d08682a2596bd62ee9dcf216b8cccd997afee9b402f5de1739e8e6467aa363749ef39392e5c66622b01c7203ec0a3d14 decrypted: 536f6d65207468696e67732061726520626574746572206c65667420756e7265616400 DONE {{success}} {{end}} ``` -------------------------------- ### Using Custom mbedTLS Config with CMake Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/configs/README.txt Define MBEDTLS_CONFIG_FILE and adjust include paths when using cmake to incorporate custom configuration files. This example also includes cleanup of existing cmake files. ```bash find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + CFLAGS="-I$PWD/configs -DMBEDTLS_CONFIG_FILE=''" cmake . make ``` -------------------------------- ### Terminal output for hashing example Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/example-hashing/README.md Expected output format displayed in the serial terminal after running the hashing application. ```text {{timeout;10}} {{host_test_name;default}} {{description;mbed TLS example on hashing}} {{test_id;MBEDTLS_EX_HASHING}} {{start}} Method 1: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Method 2: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Method 3: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Method 4: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 DONE {{success}} {{end}} ``` -------------------------------- ### Build and Test with Make Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/README.md Standard commands for building the project and executing tests using Make. ```bash make ``` ```bash make check ``` ```bash make no_test ``` ```bash programs/test/selftest ``` -------------------------------- ### Building 4NXCI from Source (Bash) Source: https://context7.com/tiliarou/4nxci/llms.txt Commands for cloning the repository, configuring the build, compiling the project, and cleaning build artifacts. ```bash # Clone repository git clone https://github.com/The-4n/4NXCI.git cd 4NXCI ``` ```bash # Create config.mk from template cp config.mk.template config.mk # Edit config.mk to set CC and LDFLAGS as needed ``` ```bash # Build (compiles mbedtls first, then 4nxci) make ``` ```bash # Clean build artifacts make clean ``` ```bash # Full clean including mbedtls make clean_full ``` ```bash # Create distribution tarball make dist ``` -------------------------------- ### Build and Test with CMake Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/README.md Standard commands for building the project and executing tests using CMake. ```bash cmake . make ``` ```bash make test ``` ```bash cmake -DENABLE_TESTING=Off . ``` ```bash programs/test/selftest ``` ```bash cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On . ``` ```bash cmake -D CMAKE_BUILD_TYPE=Debug . ``` ```bash cmake -LH ``` ```bash find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + CC=gcc CFLAGS='-fstack-protector-strong -Wa,--noexecstack' cmake . ``` -------------------------------- ### Launch 4NXCI with GUI Options (C#) Source: https://context7.com/tiliarou/4nxci/llms.txt Launches the 4NXCI command-line tool with arguments derived from GUI selections. Ensures the tool exists and general options are valid before proceeding. ```csharp // Launch 4NXCI with GUI-specified options private void launch_4nxci(string args) { if (is_4nxci_exists() && check_general_options()) { string nxci_args = ".\"" + txt_xci.Text + "."" + "-k \"" + txt_keyset.Text + "."" + "-o \"" + txt_outdir.Text + "."" + args; Process nxci = new Process(); nxci.StartInfo.FileName = ".\\4nxci.exe"; nxci.StartInfo.Arguments = nxci_args; nxci.StartInfo.UseShellExecute = false; nxci.StartInfo.RedirectStandardOutput = true; nxci.StartInfo.RedirectStandardError = true; nxci.StartInfo.CreateNoWindow = true; nxci.OutputDataReceived += OnOutputDataReceived; nxci.ErrorDataReceived += OnOutputDataReceived; nxci.Start(); nxci.BeginOutputReadLine(); nxci.BeginErrorReadLine(); } } ``` ```csharp // Convert button handler private void btn_convert_Click(object sender, RoutedEventArgs e) { string args = string.Empty; if (chk_rename.IsChecked == true) args += "-r "; // Use title name if (chk_keepncaid.IsChecked == true) args += "--keepncaid "; // Keep NCA IDs if (chk_tempfolder.IsChecked == true) args += "-t \"" + txt_outdir.Text + "\\4nxci_extracted_xci\""; launch_4nxci(args); } ``` -------------------------------- ### Prepare mbed TLS for mbed OS Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/README.md Execute these commands from the root of a cloned mbed TLS repository to prepare it for yotta builds. ```bash yotta/create-module.sh cd yotta/module ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/ssl/CMakeLists.txt Sets up PThreads for Windows and finds the Threads package. Defines the core libraries to be linked. ```cmake set(THREADS_USE_PTHREADS_WIN32 true) find_package(Threads) ``` ```cmake set(libs mbedtls ) ``` -------------------------------- ### Create NSP Archive in C Source: https://context7.com/tiliarou/4nxci/llms.txt Defines the context structure and logic for packaging files into a PFS0-formatted NSP archive. ```c // NSP context structure typedef struct { filepath_t filepath; // Output NSP path char title_name[0x200]; // Game title for filename char title_display_version[0x10]; // Version string uint8_t entry_count; // Number of files to pack nsp_entry_t *nsp_entry; // Array of file entries } nsp_ctx_t; // NSP file entry typedef struct { filepath_t filepath; // Source file path char *nsp_filename; // Filename in NSP archive uint64_t filesize; // File size in bytes } nsp_entry_t; // Create NSP package from processed content void nsp_create(nsp_ctx_t *nsp_ctx) { // Build PFS0 header pfs0_header_t nsp_header = { .magic = MAGIC_PFS0, .num_files = nsp_ctx->entry_count, .string_table_size = 42 * nsp_ctx->entry_count, .reserved = 0 }; // Write header, file entry table, and string table FILE *nsp_file = os_fopen(nsp_ctx->filepath.os_path, OS_MODE_WRITE); fwrite(&nsp_header, sizeof(pfs0_header_t), 1, nsp_file); fwrite(file_entry_table, sizeof(nsp_file_entry_table_t), nsp_ctx->entry_count, nsp_file); fwrite(string_table, 1, string_table_size, nsp_file); // Append file contents with 100MB buffer uint64_t read_size = 0x61A8000; unsigned char *buf = malloc(read_size); for (int i = 0; i < nsp_ctx->entry_count; i++) { // Copy each NCA/XML file into NSP FILE *src = os_fopen(nsp_ctx->nsp_entry[i].filepath.os_path, OS_MODE_READ); // ... buffered copy ... fclose(src); } fclose(nsp_file); } ``` -------------------------------- ### 4NXCI Command-Line Usage Source: https://github.com/tiliarou/4nxci/blob/master/README.md Execute the conversion process using the provided command-line interface for *nix or Windows systems. ```bash *nix: ./4nxci [options...] Windows: .\4nxci.exe [options...] Options: -k, --keyset Set keyset filepath, default filepath is ./keys.dat -h, --help Display usage -t, --tempdir Set temporary directory path -o, --outdir Set output directory path -r, --rename Use Titlename instead of Titleid in nsp name --keepncaid Keep current ncas ids ``` -------------------------------- ### Basic XCI to NSP Conversion Source: https://context7.com/tiliarou/4nxci/llms.txt Converts an XCI file to an NSP file in the current directory. Requires the keyset file to be in the same directory or specified with the -k option. ```bash ./4nxci game.xci ``` -------------------------------- ### Using Custom mbedTLS Config with Make Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/configs/README.txt Define MBEDTLS_CONFIG_FILE and adjust include paths when using make to incorporate custom configuration files outside the mbed TLS tree. ```bash CFLAGS="-I$PWD/configs -DMBEDTLS_CONFIG_FILE=''" make ``` -------------------------------- ### Process Content Metadata in C Source: https://context7.com/tiliarou/4nxci/llms.txt Handles metadata generation and NSP creation for gamecard and download content types. ```c // Content metadata context typedef struct { uint64_t title_id; uint64_t extended_header_patch_id; uint8_t type; // 0x80=App, 0x81=Patch, 0x82=DLC uint8_t nca_count; uint32_t title_version; unsigned char digest[0x20]; unsigned char keygen_min; uint64_t requiredsysversion; cnmt_content_record_t *cnmt_content_records; filepath_t meta_filepath; } cnmt_ctx_t; // Process gamecard content (base game, DLC) void cnmt_gamecard_process(nxci_ctx_t *tool, cnmt_xml_ctx_t *cnmt_xml_ctx, cnmt_ctx_t *cnmt_ctx, nsp_ctx_t *nsp_ctx) { // Allocate XML content entries for NCAs + meta cnmt_xml_ctx->contents = malloc((cnmt_ctx->nca_count + 1) * sizeof(cnmt_xml_content_t)); // Set title ID and patch ID sprintf(cnmt_xml_ctx->title_id, "%016" PRIx64, cnmt_ctx->title_id); sprintf(cnmt_xml_ctx->patch_id, "%016" PRIx64, cnmt_ctx->extended_header_patch_id); // Process each NCA file for (int index = 0; index < cnmt_ctx->nca_count; index++) { nca_ctx_t nca_ctx; nca_init(&nca_ctx); nca_gamecard_process(&nca_ctx, &filepath, index, cnmt_xml_ctx, cnmt_ctx, nsp_ctx); nca_free_section_contexts(&nca_ctx); } // Generate .cnmt.xml metadata file cnmt_create_xml(cnmt_xml_ctx, cnmt_ctx, nsp_ctx); // Create final NSP package nsp_create(nsp_ctx); } // Process update/patch content (includes ticket and cert) void cnmt_download_process(nxci_ctx_t *tool, cnmt_xml_ctx_t *cnmt_xml_ctx, cnmt_ctx_t *cnmt_ctx, nsp_ctx_t *nsp_ctx) { // Entry count includes .tik + .cert + .cnmt.xml + .cnmt.nca nsp_ctx->entry_count = cnmt_ctx->nca_count + 4; // Process NCAs and create NSP with licensing files // ... nsp_create(nsp_ctx); } ``` -------------------------------- ### Create Git Hook Soft Link on Linux Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/tests/git-scripts/README.md Execute this command on a GNU platform to create a soft link for the pre-push git hook script. Ensure you are in the mbed TLS `.git/hooks` directory. ```bash ln -s ../../tests/git-scripts/pre-push.sh pre-push ``` -------------------------------- ### Define Executables and Link Libraries Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/aes/CMakeLists.txt Configures the build process for the aescrypt2 and crypt_and_hash executables by linking them with the mbedtls library. ```cmake add_executable(aescrypt2 aescrypt2.c) target_link_libraries(aescrypt2 mbedtls) add_executable(crypt_and_hash crypt_and_hash.c) target_link_libraries(crypt_and_hash mbedtls) ``` -------------------------------- ### Generate Yotta module for existing mbed TLS source Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/README.md If you have a local copy of mbed TLS (e.g., from GitHub), run this script from the project root to generate the necessary yotta module files. This prepares your local source for yotta builds. ```bash yotta/create-module.sh ``` -------------------------------- ### Add Executable and Link Library Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/hash/CMakeLists.txt Defines an executable target and links it with the mbedtls library. Use this for C/C++ projects requiring mbedtls. ```cmake add_executable(hello hello.c) target_link_libraries(hello mbedtls) ``` ```cmake add_executable(generic_sum generic_sum.c) target_link_libraries(generic_sum mbedtls) ``` -------------------------------- ### SSL Anti-Replay Settings Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/scripts/data_files/rename-1.3-2.0.txt Constants for configuring SSL anti-replay protection. ```APIDOC ## SSL Anti-Replay Settings ### Description Constants for configuring SSL anti-replay protection. ### Constants - **SSL_ANTI_REPLAY_DISABLED** (MBEDTLS_SSL_ANTI_REPLAY_DISABLED) - **SSL_ANTI_REPLAY_ENABLED** (MBEDTLS_SSL_ANTI_REPLAY_ENABLED) ``` -------------------------------- ### SSL Version and Configuration Constants Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/scripts/data_files/rename-1.3-2.0.txt Various constants related to SSL versioning, buffer lengths, and configuration options. ```APIDOC ## SSL Version and Configuration Constants ### Description Various constants related to SSL versioning, buffer lengths, and configuration options. ### Constants - **SSL_BUFFER_LEN** (MBEDTLS_SSL_BUFFER_LEN) - **SSL_CACHE_DEFAULT_MAX_ENTRIES** (MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES) - **SSL_CACHE_DEFAULT_TIMEOUT** (MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT) - **SSL_CERTIFICATE_REQUEST** (MBEDTLS_SSL_CERTIFICATE_REQUEST) - **SSL_CERTIFICATE_VERIFY** (MBEDTLS_SSL_CERTIFICATE_VERIFY) - **SSL_CERT_TYPE_ECDSA_SIGN** (MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN) - **SSL_CERT_TYPE_RSA_SIGN** (MBEDTLS_SSL_CERT_TYPE_RSA_SIGN) - **SSL_CHANNEL_INBOUND** (MBEDTLS_SSL_CHANNEL_INBOUND) - **SSL_CHANNEL_OUTBOUND** (MBEDTLS_SSL_CHANNEL_OUTBOUND) - **SSL_CLIENT_CERTIFICATE** (MBEDTLS_SSL_CLIENT_CERTIFICATE) - **SSL_CLIENT_CHANGE_CIPHER_SPEC** (MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC) - **SSL_CLIENT_FINISHED** (MBEDTLS_SSL_CLIENT_FINISHED) - **SSL_CLIENT_HELLO** (MBEDTLS_SSL_CLIENT_HELLO) - **SSL_CLIENT_KEY_EXCHANGE** (MBEDTLS_SSL_CLIENT_KEY_EXCHANGE) - **SSL_DEFAULT_TICKET_LIFETIME** (MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME) - **SSL_DTLS_TIMEOUT_DFL_MAX** (MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX) - **SSL_DTLS_TIMEOUT_DFL_MIN** (MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN) - **SSL_EMPTY_RENEGOTIATION_INFO** (MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO) - **SSL_ETM_DISABLED** (MBEDTLS_SSL_ETM_DISABLED) - **SSL_ETM_ENABLED** (MBEDTLS_SSL_ETM_ENABLED) - **SSL_EXTENDED_MS_DISABLED** (MBEDTLS_SSL_EXTENDED_MS_DISABLED) - **SSL_EXTENDED_MS_ENABLED** (MBEDTLS_SSL_EXTENDED_MS_ENABLED) - **SSL_FALLBACK_SCSV** (MBEDTLS_SSL_FALLBACK_SCSV) - **SSL_FLUSH_BUFFERS** (MBEDTLS_SSL_FLUSH_BUFFERS) - **SSL_IS_CLIENT** (MBEDTLS_SSL_IS_CLIENT) - **SSL_IS_FALLBACK** (MBEDTLS_SSL_IS_FALLBACK) - **SSL_IS_NOT_FALLBACK** (MBEDTLS_SSL_IS_NOT_FALLBACK) - **SSL_IS_SERVER** (MBEDTLS_SSL_IS_SERVER) - **SSL_LEGACY_ALLOW_RENEGOTIATION** (MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION) - **SSL_LEGACY_BREAK_HANDSHAKE** (MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE) - **SSL_LEGACY_NO_RENEGOTIATION** (MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION) - **SSL_LEGACY_RENEGOTIATION** (MBEDTLS_SSL_LEGACY_RENEGOTIATION) - **SSL_MAC_ADD** (MBEDTLS_SSL_MAC_ADD) - **SSL_MAJOR_VERSION_3** (MBEDTLS_SSL_MAJOR_VERSION_3) - **SSL_MAX_CONTENT_LEN** (MBEDTLS_SSL_MAX_CONTENT_LEN) - **SSL_MAX_FRAG_LEN_1024** (MBEDTLS_SSL_MAX_FRAG_LEN_1024) - **SSL_MAX_FRAG_LEN_2048** (MBEDTLS_SSL_MAX_FRAG_LEN_2048) - **SSL_MAX_FRAG_LEN_4096** (MBEDTLS_SSL_MAX_FRAG_LEN_4096) - **SSL_MAX_FRAG_LEN_512** (MBEDTLS_SSL_MAX_FRAG_LEN_512) - **SSL_MAX_FRAG_LEN_INVALID** (MBEDTLS_SSL_MAX_FRAG_LEN_INVALID) - **SSL_MAX_FRAG_LEN_NONE** (MBEDTLS_SSL_MAX_FRAG_LEN_NONE) - **SSL_MAX_MAJOR_VERSION** (MBEDTLS_SSL_MAX_MAJOR_VERSION) - **SSL_MAX_MINOR_VERSION** (MBEDTLS_SSL_MAX_MINOR_VERSION) - **SSL_MINOR_VERSION_0** (MBEDTLS_SSL_MINOR_VERSION_0) - **SSL_MINOR_VERSION_1** (MBEDTLS_SSL_MINOR_VERSION_1) - **SSL_MINOR_VERSION_2** (MBEDTLS_SSL_MINOR_VERSION_2) - **SSL_MINOR_VERSION_3** (MBEDTLS_SSL_MINOR_VERSION_3) - **SSL_MIN_MAJOR_VERSION** (MBEDTLS_SSL_MIN_MAJOR_VERSION) - **SSL_MIN_MINOR_VERSION** (MBEDTLS_SSL_MIN_MINOR_VERSION) - **SSL_PADDING_ADD** (MBEDTLS_SSL_PADDING_ADD) ``` -------------------------------- ### Handle Out-of-Source Build Data Files Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/tests/CMakeLists.txt Creates symbolic links for data files when performing an out-of-source build. ```cmake if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) # Get OS dependent path to use in `execute_process` file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/data_files" link) file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data_files" target) if (NOT EXISTS ${link}) if (CMAKE_HOST_UNIX) set(command ln -s ${target} ${link}) else() set(command cmd.exe /c mklink /j ${link} ${target}) endif() execute_process(COMMAND ${command} RESULT_VARIABLE result ERROR_VARIABLE output) if (NOT ${result} EQUAL 0) message(FATAL_ERROR "Could not create symbolic link for: ${target} --> ${output}") endif() endif() endif() ``` -------------------------------- ### Specify Keyset File Location Source: https://context7.com/tiliarou/4nxci/llms.txt Converts an XCI file to NSP format using a specified keyset file for decryption. Ensure the path to the keyset file is correct. ```bash ./4nxci -k /path/to/keys.dat game.xci ``` -------------------------------- ### Set Custom Output Directory Source: https://context7.com/tiliarou/4nxci/llms.txt Converts an XCI file to NSP format and saves the output to a specified directory. This helps organize converted files. ```bash ./4nxci -o /output/folder game.xci ``` -------------------------------- ### HFS0 Partition Handling Source: https://context7.com/tiliarou/4nxci/llms.txt Structures and functions for reading and managing Hash File System (HFS0) partitions found in XCI files. ```APIDOC ## HFS0 Partition Handling ### Description Handles the parsing of HFS0 headers and file entries to allow extraction and processing of files within XCI partitions. ### Functions - **hfs0_get_file_entry(hfs0_header_t *hdr, uint32_t i)** - Retrieves a file entry by index. - **hfs0_get_file_name(hfs0_header_t *hdr, uint32_t i)** - Retrieves the filename from the string table by index. - **hfs0_process(hfs0_ctx_t *ctx)** - Processes the HFS0 partition. - **hfs0_save_file(hfs0_ctx_t *ctx, uint32_t i, filepath_t *dirpath)** - Saves a specific file from the HFS0 partition to the disk. ``` -------------------------------- ### Add Executable and Link Libraries Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/test/CMakeLists.txt This code adds an executable target and links the previously defined libraries to it. Repeat for each executable. ```cmake add_executable(selftest selftest.c) target_link_libraries(selftest ${libs}) ``` ```cmake add_executable(benchmark benchmark.c) target_link_libraries(benchmark ${libs}) ``` ```cmake add_executable(ssl_cert_test ssl_cert_test.c) target_link_libraries(ssl_cert_test ${libs}) ``` ```cmake add_executable(udp_proxy udp_proxy.c) target_link_libraries(udp_proxy ${libs}) ``` -------------------------------- ### HFS0 Partition Structures and Functions (C) Source: https://context7.com/tiliarou/4nxci/llms.txt Defines structures for HFS0 headers and file entries, along with utility functions for accessing file information within HFS0 partitions. ```c // HFS0 header structure typedef struct { uint32_t magic; // "HFS0" uint32_t num_files; uint32_t string_table_size; uint32_t reserved; } hfs0_header_t; ``` ```c // HFS0 file entry typedef struct { uint64_t offset; uint64_t size; uint32_t string_table_offset; uint32_t hashed_size; uint64_t reserved; unsigned char hash[0x20]; // SHA-256 hash } hfs0_file_entry_t; ``` ```c // Get file entry by index static inline hfs0_file_entry_t *hfs0_get_file_entry(hfs0_header_t *hdr, uint32_t i) { if (i >= hdr->num_files) return NULL; return (hfs0_file_entry_t *)((char *)(hdr) + sizeof(*hdr) + i * sizeof(hfs0_file_entry_t)); } ``` ```c // Get filename from string table static inline char *hfs0_get_file_name(hfs0_header_t *hdr, uint32_t i) { return hfs0_get_string_table(hdr) + hfs0_get_file_entry(hdr, i)->string_table_offset; } ``` ```c // Process HFS0 partition void hfs0_process(hfs0_ctx_t *ctx); ``` ```c // Save file from HFS0 partition to disk void hfs0_save_file(hfs0_ctx_t *ctx, uint32_t i, filepath_t *dirpath); ``` -------------------------------- ### Configure Null Entropy Security Warning Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/CMakeLists.txt Checks for the MBEDTLS_TEST_NULL_ENTROPY configuration and issues a build-time warning or error if enabled without explicit user confirmation. ```cmake set(WARNING_BORDER "*******************************************************\n") set(NULL_ENTROPY_WARN_L1 "**** WARNING! MBEDTLS_TEST_NULL_ENTROPY defined!\n") set(NULL_ENTROPY_WARN_L2 "**** THIS BUILD HAS NO DEFINED ENTROPY SOURCES\n") set(NULL_ENTROPY_WARN_L3 "**** AND IS *NOT* SUITABLE FOR PRODUCTION USE\n") set(NULL_ENTROPY_WARNING "${WARNING_BORDER}" "${NULL_ENTROPY_WARN_L1}" "${NULL_ENTROPY_WARN_L2}" "${NULL_ENTROPY_WARN_L3}" "${WARNING_BORDER}") find_package(Perl) if(PERL_FOUND) # If NULL Entropy is configured, display an appropriate warning execute_process(COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/config.pl -f ${CMAKE_SOURCE_DIR}/include/mbedtls/config.h get MBEDTLS_TEST_NULL_ENTROPY RESULT_VARIABLE result) if(${result} EQUAL 0) message(WARNING ${NULL_ENTROPY_WARNING}) if(NOT UNSAFE_BUILD) message(FATAL_ERROR "\ \n\ Warning! You have enabled MBEDTLS_TEST_NULL_ENTROPY. \ This option is not safe for production use and negates all security \ It is intended for development use only. \ \n\ To confirm you want to build with this option, re-run cmake with the \ option: \n\ cmake -DUNSAFE_BUILD=ON ") return() endif() endif() endif() ``` -------------------------------- ### Configure mbed TLS build options with CMake Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/CMakeLists.txt Defines project requirements and build-time toggles for optional libraries and testing suites. ```cmake cmake_minimum_required(VERSION 2.6) project("mbed TLS" C) option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF) option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF) option(ENABLE_PROGRAMS "Build mbed TLS programs." ON) option(UNSAFE_BUILD "Allow unsafe builds. These builds ARE NOT SECURE." OFF) # the test suites currently have compile errors with MSVC if(MSVC) option(ENABLE_TESTING "Build mbed TLS tests." OFF) else() option(ENABLE_TESTING "Build mbed TLS tests." ON) endif() ``` -------------------------------- ### Executable Definitions and Linking Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/ssl/CMakeLists.txt Defines various TLS/DTLS client and server executables and links them with the specified libraries. ```cmake add_executable(dtls_client dtls_client.c) target_link_libraries(dtls_client ${libs}) ``` ```cmake add_executable(dtls_server dtls_server.c) target_link_libraries(dtls_server ${libs}) ``` ```cmake add_executable(ssl_client1 ssl_client1.c) target_link_libraries(ssl_client1 ${libs}) ``` ```cmake add_executable(ssl_client2 ssl_client2.c) target_link_libraries(ssl_client2 ${libs}) ``` ```cmake add_executable(ssl_server ssl_server.c) target_link_libraries(ssl_server ${libs}) ``` ```cmake add_executable(ssl_server2 ssl_server2.c) target_link_libraries(ssl_server2 ${libs}) ``` ```cmake add_executable(ssl_fork_server ssl_fork_server.c) target_link_libraries(ssl_fork_server ${libs}) ``` ```cmake add_executable(ssl_mail_client ssl_mail_client.c) target_link_libraries(ssl_mail_client ${libs}) ``` ```cmake add_executable(mini_client mini_client.c) target_link_libraries(mini_client ${libs}) ``` -------------------------------- ### Build mbed TLS from a local source using Yotta Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/README.md After generating the yotta module for a local mbed TLS source, navigate to the module directory and build. This is for developers working directly with the source code. ```bash cd yotta/module yotta build ``` -------------------------------- ### Set Build Type and Compiler Flags Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/CMakeLists.txt Configures build types and applies compiler-specific warning and optimization flags for GCC, Clang, and MSVC. ```cmake set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build: None Debug Release Coverage ASan ASanDbg MemSan MemSanDbg Check CheckFull" FORCE) string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}") if(CMAKE_COMPILER_IS_GNUCC) # some warnings we want are not available with old GCC versions # note: starting with CMake 2.8 we could use CMAKE_C_COMPILER_VERSION execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings") if (GCC_VERSION VERSION_GREATER 4.5 OR GCC_VERSION VERSION_EQUAL 4.5) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op") endif() if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") endif() set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") set(CMAKE_C_FLAGS_ASAN "-Werror -fsanitize=address -fno-common -O3") set(CMAKE_C_FLAGS_ASANDBG "-Werror -fsanitize=address -fno-common -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls ") set(CMAKE_C_FLAGS_CHECK "-Werror -Os") set(CMAKE_C_FLAGS_CHECKFULL "${CMAKE_C_FLAGS_CHECK} -Wcast-qual") endif(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_CLANG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") set(CMAKE_C_FLAGS_ASAN "-Werror -fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover -O3") set(CMAKE_C_FLAGS_ASANDBG "-Werror -fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls ") set(CMAKE_C_FLAGS_MEMSAN "-Werror -fsanitize=memory -O3") set(CMAKE_C_FLAGS_MEMSANDBG "-Werror -fsanitize=memory -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2") set(CMAKE_C_FLAGS_CHECK "-Werror -Os") endif(CMAKE_COMPILER_IS_CLANG) if(MSVC) # Strictest warnings, and treat as errors set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") endif(MSVC) ``` -------------------------------- ### SSL Renegotiation Settings Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/scripts/data_files/rename-1.3-2.0.txt Constants for controlling SSL renegotiation behavior. ```APIDOC ## SSL Renegotiation Settings ### Description Constants for controlling SSL renegotiation behavior. ### Constants - **SSL_RENEGOTIATION** (MBEDTLS_SSL_RENEGOTIATION) - **SSL_RENEGOTIATION_DISABLED** (MBEDTLS_SSL_RENEGOTIATION_DISABLED) ``` -------------------------------- ### Configure CMake Build Targets Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/x509/CMakeLists.txt Defines executable targets and links them against required libraries with optional support for PKCS11 and ZLIB. ```cmake set(libs mbedtls ) if(USE_PKCS11_HELPER_LIBRARY) set(libs ${libs} pkcs11-helper) endif(USE_PKCS11_HELPER_LIBRARY) if(ENABLE_ZLIB_SUPPORT) set(libs ${libs} ${ZLIB_LIBRARIES}) endif(ENABLE_ZLIB_SUPPORT) add_executable(cert_app cert_app.c) target_link_libraries(cert_app ${libs}) add_executable(crl_app crl_app.c) target_link_libraries(crl_app ${libs}) add_executable(req_app req_app.c) target_link_libraries(req_app ${libs}) add_executable(cert_req cert_req.c) target_link_libraries(cert_req ${libs}) add_executable(cert_write cert_write.c) target_link_libraries(cert_write ${libs}) install(TARGETS cert_app crl_app req_app cert_req cert_write DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Add Executable and Link Library Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/pkey/CMakeLists.txt Defines an executable target and links it with the mbedtls library. This is a common pattern for cryptographic applications. ```cmake add_executable(dh_client dh_client.c) target_link_libraries(dh_client mbedtls) ``` ```cmake add_executable(dh_genprime dh_genprime.c) target_link_libraries(dh_genprime mbedtls) ``` ```cmake add_executable(dh_server dh_server.c) target_link_libraries(dh_server mbedtls) ``` ```cmake add_executable(ecdh_curve25519 ecdh_curve25519.c) target_link_libraries(ecdh_curve25519 mbedtls) ``` ```cmake add_executable(ecdsa ecdsa.c) target_link_libraries(ecdsa mbedtls) ``` ```cmake add_executable(gen_key gen_key.c) target_link_libraries(gen_key mbedtls) ``` ```cmake add_executable(key_app key_app.c) target_link_libraries(key_app mbedtls) ``` ```cmake add_executable(key_app_writer key_app_writer.c) target_link_libraries(key_app_writer mbedtls) ``` ```cmake add_executable(mpi_demo mpi_demo.c) target_link_libraries(mpi_demo mbedtls) ``` ```cmake add_executable(rsa_genkey rsa_genkey.c) target_link_libraries(rsa_genkey mbedtls) ``` ```cmake add_executable(rsa_sign rsa_sign.c) target_link_libraries(rsa_sign mbedtls) ``` ```cmake add_executable(rsa_verify rsa_verify.c) target_link_libraries(rsa_verify mbedtls) ``` ```cmake add_executable(rsa_sign_pss rsa_sign_pss.c) target_link_libraries(rsa_sign_pss mbedtls) ``` ```cmake add_executable(rsa_verify_pss rsa_verify_pss.c) target_link_libraries(rsa_verify_pss mbedtls) ``` ```cmake add_executable(rsa_encrypt rsa_encrypt.c) target_link_libraries(rsa_encrypt mbedtls) ``` ```cmake add_executable(rsa_decrypt rsa_decrypt.c) target_link_libraries(rsa_decrypt mbedtls) ``` ```cmake add_executable(pk_sign pk_sign.c) target_link_libraries(pk_sign mbedtls) ``` ```cmake add_executable(pk_verify pk_verify.c) target_link_libraries(pk_verify mbedtls) ``` ```cmake add_executable(pk_encrypt pk_encrypt.c) target_link_libraries(pk_encrypt mbedtls) ``` ```cmake add_executable(pk_decrypt pk_decrypt.c) target_link_libraries(pk_decrypt mbedtls) ``` -------------------------------- ### Benchmark Output Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/example-benchmark/README.md The output displays performance metrics for various cryptographic primitives, including hash functions, symmetric encryption algorithms, and asymmetric cryptography. Performance data is indicative and may vary. ```text {{timeout;150}} {{host_test_name;default}} {{description;mbed TLS benchmark program}} {{test_id;MBEDTLS_BENCHMARK}} {{start}} SHA-1 : 3644 Kb/s, 32 cycles/byte SHA-256 : 1957 Kb/s, 59 cycles/byte SHA-512 : 587 Kb/s, 200 cycles/byte AES-CBC-128 : 1359 Kb/s, 86 cycles/byte AES-CBC-192 : 1183 Kb/s, 99 cycles/byte AES-CBC-256 : 1048 Kb/s, 111 cycles/byte AES-GCM-128 : 421 Kb/s, 279 cycles/byte AES-GCM-192 : 403 Kb/s, 292 cycles/byte AES-GCM-256 : 385 Kb/s, 305 cycles/byte AES-CCM-128 : 542 Kb/s, 216 cycles/byte AES-CCM-192 : 484 Kb/s, 242 cycles/byte AES-CCM-256 : 437 Kb/s, 268 cycles/byte CTR_DRBG (NOPR) : 1002 Kb/s, 117 cycles/byte CTR_DRBG (PR) : 705 Kb/s, 166 cycles/byte HMAC_DRBG SHA-1 (NOPR) : 228 Kb/s, 517 cycles/byte HMAC_DRBG SHA-1 (PR) : 210 Kb/s, 561 cycles/byte HMAC_DRBG SHA-256 (NOPR) : 212 Kb/s, 557 cycles/byte HMAC_DRBG SHA-256 (PR) : 185 Kb/s, 637 cycles/byte RSA-2048 : 41 ms/ public RSA-2048 : 1349 ms/private RSA-4096 : 134 ms/ public RSA-4096 : 7149 ms/private ECDSA-secp384r1 : 640 ms/sign ECDSA-secp256r1 : 387 ms/sign ECDSA-secp384r1 : 1233 ms/verify ECDSA-secp256r1 : 751 ms/verify ECDHE-secp384r1 : 1191 ms/handshake ECDHE-secp256r1 : 730 ms/handshake ECDHE-Curve25519 : 611 ms/handshake ECDH-secp384r1 : 584 ms/handshake ECDH-secp256r1 : 365 ms/handshake ECDH-Curve25519 : 303 ms/handshake {{success}} {{end}} ``` -------------------------------- ### Define Executables and Link Mbed TLS Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/random/CMakeLists.txt Configures build targets for random number generation utilities and links them against the Mbed TLS library. ```cmake add_executable(gen_random_havege gen_random_havege.c) target_link_libraries(gen_random_havege mbedtls) add_executable(gen_random_ctr_drbg gen_random_ctr_drbg.c) target_link_libraries(gen_random_ctr_drbg mbedtls) add_executable(gen_entropy gen_entropy.c) target_link_libraries(gen_entropy mbedtls) install(TARGETS gen_random_havege gen_random_ctr_drbg gen_entropy DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Define Libraries and Conditional Dependencies Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/test/CMakeLists.txt This snippet defines the core libraries and conditionally adds others based on build flags like USE_PKCS11_HELPER_LIBRARY and ENABLE_ZLIB_SUPPORT. ```cmake set(libs mbedtls ) if(USE_PKCS11_HELPER_LIBRARY) set(libs ${libs} pkcs11-helper) endif(USE_PKCS11_HELPER_LIBRARY) if(ENABLE_ZLIB_SUPPORT) set(libs ${libs} ${ZLIB_LIBRARIES}) endif(ENABLE_ZLIB_SUPPORT) ``` -------------------------------- ### Set user configuration file in yotta Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/yotta/data/README.md Specify the path to the custom configuration header file within the application's config.json. ```json { "mbedtls": { "user-config-file": "\"myapp/mbedtls-config-changes.h\"" } } ``` -------------------------------- ### PThreads Server Configuration Source: https://github.com/tiliarou/4nxci/blob/master/mbedtls/programs/ssl/CMakeLists.txt Conditionally adds a PThreads-based SSL server executable if the Threads package is found. Links it with necessary libraries, including thread support. ```cmake if(THREADS_FOUND) add_executable(ssl_pthread_server ssl_pthread_server.c) target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT}) set(targets ${targets} ssl_pthread_server) endif(THREADS_FOUND) ```