diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5bf6f54a..06988ffd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 3.5) project(tinydtls-tests) -add_executable(dtls-server dtls-server.c dtls_ciphers_util.c) +add_executable(dtls-server dtls-server.c) target_link_libraries(dtls-server LINK_PUBLIC tinydtls) target_compile_options(dtls-server PUBLIC -Wall -DTEST_INCLUDE -DDTLSv12 -DWITH_SHA256) if(${WARNING_TO_ERROR}) @@ -37,7 +37,7 @@ if(${WARNING_TO_ERROR}) target_compile_options(ccm-test PUBLIC -Werror) endif() -add_executable(dtls-client dtls-client.c dtls_ciphers_util.c) +add_executable(dtls-client dtls-client.c) target_link_libraries(dtls-client LINK_PUBLIC tinydtls) target_compile_options(dtls-client PUBLIC -Wall -DTEST_INCLUDE -DDTLSv12 -DWITH_SHA256) if(${WARNING_TO_ERROR}) diff --git a/tests/dtls-client.c b/tests/dtls-client.c index 6c927c5e..d586b70a 100644 --- a/tests/dtls-client.c +++ b/tests/dtls-client.c @@ -568,3 +568,4 @@ main(int argc, char **argv) { exit(0); } +#include "dtls_ciphers_util.c" diff --git a/tests/dtls-server.c b/tests/dtls-server.c index 6f2b87d0..a0404831 100644 --- a/tests/dtls-server.c +++ b/tests/dtls-server.c @@ -428,3 +428,6 @@ main(int argc, char **argv) { dtls_free_context(the_context); exit(0); } + +#include "dtls_ciphers_util.c" + diff --git a/tests/dtls_ciphers_util.c b/tests/dtls_ciphers_util.c index 2fc749bd..915e6969 100644 --- a/tests/dtls_ciphers_util.c +++ b/tests/dtls_ciphers_util.c @@ -41,7 +41,7 @@ static const struct cipher_entry map[] = { static dtls_cipher_t ciphers_table[ARRAY_LENGTH] = { TLS_NULL_WITH_NULL_NULL }; static dtls_cipher_t find_cipher_suite(const char *arg) { - for (int index=0; index < ARRAY_LENGTH - 1; ++index) { + for (size_t index=0; index < ARRAY_LENGTH - 1; ++index) { size_t len = strlen(map[index].name); if (strncmp(arg, map[index].name, len) == 0 && (arg[len] == 0 || arg[len] == SEP)) { return map[index].cipher; @@ -51,7 +51,7 @@ static dtls_cipher_t find_cipher_suite(const char *arg) { } static void add_cipher_suite(dtls_cipher_t cipher) { - for (int index=0; index < ARRAY_LENGTH - 1; ++index) { + for (size_t index=0; index < ARRAY_LENGTH - 1; ++index) { if (ciphers_table[index] == cipher) { return; }