diff --git a/build_win.log b/build_win.log index 23c2953..ff934ee 100644 --- a/build_win.log +++ b/build_win.log @@ -12,52 +12,16 @@ make[2]: Entering directory '/c/ARM/_uTun/utun2/tests' make all-am make[3]: Entering directory '/c/ARM/_uTun/utun2/tests' x86_64-w64-mingw32-gcc -I../tinycrypt/lib/include -I../tinycrypt/lib/source -I../lib -g -O2 -o test_crypto.exe test_crypto-test_crypto.o ../src/utun-aes_encrypt.o ../src/utun-aes_decrypt.o ../src/utun-ccm_mode.o ../src/utun-cmac_mode.o ../src/utun-ctr_mode.o ../src/utun-ecc.o ../src/utun-ecc_dh.o ../src/utun-ecc_dsa.o ../src/utun-sha256.o ../src/utun-ecc_platform_specific.o ../src/utun-utils.o ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto -x86_64-w64-mingw32-gcc -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -o test_pkt_normalizer_standalone.exe test_pkt_normalizer_standalone-test_pkt_normalizer_standalone.o ../src/utun-pkt_normalizer.o ../src/utun-route_lib.o ../src/utun-routing.o ../src/utun-etcp_api.o ../src/utun-aes_encrypt.o ../src/utun-aes_decrypt.o ../src/utun-ccm_mode.o ../src/utun-cmac_mode.o ../src/utun-ctr_mode.o ../src/utun-ecc.o ../src/utun-ecc_dh.o ../src/utun-ecc_dsa.o ../src/utun-sha256.o ../src/utun-ecc_platform_specific.o ../src/utun-utils.o ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto -x86_64-w64-mingw32-gcc -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -o test_etcp_api.exe test_etcp_api-test_etcp_api.o ../src/utun-config_parser.o ../src/utun-config_updater.o ../src/utun-route_lib.o ../src/utun-route_bgp.o ../src/utun-routing.o ../src/utun-tun_if.o ../src/utun-tun_windows.o ../src/utun-utun_instance.o ../src/utun-etcp.o ../src/utun-etcp_connections.o ../src/utun-etcp_loadbalancer.o ../src/utun-pkt_normalizer.o ../src/utun-etcp_api.o ../src/utun-secure_channel.o ../src/utun-crc32.o -lcrypto ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../lib -g -O2 -MT test_ll_queue-test_ll_queue.o -MD -MP -MF .deps/test_ll_queue-test_ll_queue.Tpo -c -o test_ll_queue-test_ll_queue.o `test -f 'test_ll_queue.c' || echo './'`test_ll_queue.c +x86_64-w64-mingw32-gcc -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -o test_pkt_normalizer_standalone.exe test_pkt_normalizer_standalone-test_pkt_normalizer_standalone.o ../src/utun-pkt_normalizer.o ../src/utun-route_lib.o ../src/utun-routing.o ../src/utun-etcp_api.o ../src/utun-aes_encrypt.o ../src/utun-aes_decrypt.o ../src/utun-ccm_mode.o ../src/utun-cmac_mode.o ../src/utun-ctr_mode.o ../src/utun-ecc.o ../src/utun-ecc_dh.o ../src/utun-ecc_dsa.o ../src/utun-sha256.o ../src/utun-ecc_platform_specific.o ../src/utun-utils.o ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto +x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../tinycrypt/lib/include -I../tinycrypt/lib/source -I../lib -g -O2 -MT test_ecc_encrypt-test_ecc_encrypt.o -MD -MP -MF .deps/test_ecc_encrypt-test_ecc_encrypt.Tpo -c -o test_ecc_encrypt-test_ecc_encrypt.o `test -f 'test_ecc_encrypt.c' || echo './'`test_ecc_encrypt.c C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../src/utun-ecc.o:ecc.c:(.data+0x0): undefined reference to `default_CSPRNG' -collect2.exe: error: ld returned 1 exit status -make[3]: *** [Makefile:899: test_crypto.exe] Error 1 -make[3]: *** Waiting for unfinished jobs.... C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../src/utun-ecc.o:ecc.c:(.data+0x0): undefined reference to `default_CSPRNG' collect2.exe: error: ld returned 1 exit status make[3]: *** [Makefile:955: test_pkt_normalizer_standalone.exe] Error 1 -In file included from ../lib/u_async.h:8, - from test_ll_queue.c:14: -../lib/platform_compat.h:44:23: error: static declaration of 'gettimeofday' follows non-static declaration - 44 | static inline int gettimeofday(struct timeval *tv, void *tz) { - | ^~~~~~~~~~~~ -In file included from test_ll_queue.c:11: -C:/msys64/ucrt64/include/sys/time.h:42:13: note: previous declaration of 'gettimeofday' with type 'int(struct timeval * restrict, void * restrict)' - 42 | int __cdecl gettimeofday(struct timeval *__restrict__, - | ^~~~~~~~~~~~ -make[3]: *** [Makefile:1217: test_ll_queue-test_ll_queue.o] Error 1 -make[3]: Leaving directory '/c/ARM/_uTun/utun2/tests' -make[2]: *** [Makefile:844: all] Error 2 -make[2]: Leaving directory '/c/ARM/_uTun/utun2/tests' -make[1]: *** [Makefile:379: all-recursive] Error 1 -make[1]: Leaving directory '/c/ARM/_uTun/utun2' -make: *** [Makefile:320: all] Error 2 -'. -make[2]: Leaving directory '/c/ARM/_uTun/utun2/lib' -Making all in src -make[2]: Entering directory '/c/ARM/_uTun/utun2/src' -make[2]: Leaving directory '/c/ARM/_uTun/utun2/src' -Making all in tests -make[2]: Entering directory '/c/ARM/_uTun/utun2/tests' -make all-am -make[3]: Entering directory '/c/ARM/_uTun/utun2/tests' -x86_64-w64-mingw32-gcc -I../tinycrypt/lib/include -I../tinycrypt/lib/source -I../lib -g -O2 -o test_crypto.exe test_crypto-test_crypto.o ../src/utun-aes_encrypt.o ../src/utun-aes_decrypt.o ../src/utun-ccm_mode.o ../src/utun-cmac_mode.o ../src/utun-ctr_mode.o ../src/utun-ecc.o ../src/utun-ecc_dh.o ../src/utun-ecc_dsa.o ../src/utun-sha256.o ../src/utun-ecc_platform_specific.o ../src/utun-utils.o ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto -x86_64-w64-mingw32-gcc -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -o test_pkt_normalizer_standalone.exe test_pkt_normalizer_standalone-test_pkt_normalizer_standalone.o ../src/utun-pkt_normalizer.o ../src/utun-route_lib.o ../src/utun-routing.o ../src/utun-etcp_api.o ../src/utun-aes_encrypt.o ../src/utun-aes_decrypt.o ../src/utun-ccm_mode.o ../src/utun-cmac_mode.o ../src/utun-ctr_mode.o ../src/utun-ecc.o ../src/utun-ecc_dh.o ../src/utun-ecc_dsa.o ../src/utun-sha256.o ../src/utun-ecc_platform_specific.o ../src/utun-utils.o ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto -x86_64-w64-mingw32-gcc -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -o test_etcp_api.exe test_etcp_api-test_etcp_api.o ../src/utun-config_parser.o ../src/utun-config_updater.o ../src/utun-route_lib.o ../src/utun-route_bgp.o ../src/utun-routing.o ../src/utun-tun_if.o ../src/utun-tun_windows.o ../src/utun-utun_instance.o ../src/utun-etcp.o ../src/utun-etcp_connections.o ../src/utun-etcp_loadbalancer.o ../src/utun-pkt_normalizer.o ../src/utun-etcp_api.o ../src/utun-secure_channel.o ../src/utun-crc32.o -lcrypto ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -ladvapi32 -lcrypto -x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../lib -g -O2 -MT test_ll_queue-test_ll_queue.o -MD -MP -MF .deps/test_ll_queue-test_ll_queue.Tpo -c -o test_ll_queue-test_ll_queue.o `test -f 'test_ll_queue.c' || echo './'`test_ll_queue.c -C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../src/utun-ecc.o:ecc.c:(.data+0x0): undefined reference to `default_CSPRNG' -collect2.exe: error: ld returned 1 exit status -make[3]: *** [Makefile:899: test_crypto.exe] Error 1 make[3]: *** Waiting for unfinished jobs.... -C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../src/utun-ecc.o:ecc.c:(.data+0x0): undefined reference to `default_CSPRNG' collect2.exe: error: ld returned 1 exit status -make[3]: *** [Makefile:955: test_pkt_normalizer_standalone.exe] Error 1 +make[3]: *** [Makefile:899: test_crypto.exe] Error 1 In file included from ../lib/u_async.h:8, from test_ll_queue.c:14: ../lib/platform_compat.h:44:23: error: static declaration of 'gettimeofday' follows non-static declaration @@ -68,6 +32,7 @@ C:/msys64/ucrt64/include/sys/time.h:42:13: note: previous declaration of 'gettim 42 | int __cdecl gettimeofday(struct timeval *__restrict__, | ^~~~~~~~~~~~ make[3]: *** [Makefile:1217: test_ll_queue-test_ll_queue.o] Error 1 +mv -f .deps/test_ecc_encrypt-test_ecc_encrypt.Tpo .deps/test_ecc_encrypt-test_ecc_encrypt.Po make[3]: Leaving directory '/c/ARM/_uTun/utun2/tests' make[2]: *** [Makefile:844: all] Error 2 make[2]: Leaving directory '/c/ARM/_uTun/utun2/tests' @@ -75,5 +40,8 @@ make[1]: *** [Makefile:379: all-recursive] Error 1 make[1]: Leaving directory '/c/ARM/_uTun/utun2' make: *** [Makefile:320: all] Error 2 +make[1]: Leaving directory '/c/ARM/_uTun/utun2' +make: *** [Makefile:320: all] Error 2 + ERROR: Build failed! Check build_win.log (Windows) or build_linux.log (Linux) for details diff --git a/lib/platform_compat.h b/lib/platform_compat.h index 1be73ce..8a72072 100644 --- a/lib/platform_compat.h +++ b/lib/platform_compat.h @@ -39,24 +39,8 @@ #define POLLPRI 0x0002 #endif - // gettimeofday for Windows (timezone already defined in time.h) - // Note: MSYS2 already has gettimeofday in sys/time.h, so we skip it here - #if !defined(HAVE_GETTIMEOFDAY) && !defined(__MINGW32__) - static inline int gettimeofday(struct timeval *tv, void *tz) { - (void)tz; - if (tv) { - FILETIME ft; - ULARGE_INTEGER ull; - GetSystemTimeAsFileTime(&ft); - ull.LowPart = ft.dwLowDateTime; - ull.HighPart = ft.dwHighDateTime; - // Convert from 100-nanosecond intervals since 1601 to Unix epoch - tv->tv_sec = (long)(ull.QuadPart / 10000000ULL - 11644473600ULL); - tv->tv_usec = (long)((ull.QuadPart % 10000000ULL) / 10); - } - return 0; - } - #endif + // gettimeofday for Windows (use system implementation if available) + #include // Pipe creation for Windows static inline int platform_pipe(int pipefd[2]) { diff --git a/tinycrypt/lib/source/ecc_platform_specific.c b/tinycrypt/lib/source/ecc_platform_specific.c index 93b7edb..6ae6cdd 100644 --- a/tinycrypt/lib/source/ecc_platform_specific.c +++ b/tinycrypt/lib/source/ecc_platform_specific.c @@ -135,3 +135,4 @@ int default_CSPRNG(uint8_t *dest, unsigned int size) { #endif /* platform */ +/* Force rebuild */