Browse Source

Fix Windows build: add default_CSPRNG and improve build.sh error handling

- Add Windows implementation of default_CSPRNG() using CryptGenRandom
- Add fallback stub for platforms without CSPRNG support
- Fix build.sh to properly detect build failures (use PIPESTATUS)
- Show proper error message instead of "Build completed successfully" on failure
nodeinfo-routing-update
Evgeny 2 months ago
parent
commit
f5faa7c834
  1. 26
      build.sh
  2. 266
      build_win.log
  3. BIN
      tests/test_bgp_route_exchange
  4. 2
      tests/test_bgp_route_exchange.c
  5. BIN
      tests/test_config_debug
  6. 2
      tests/test_config_debug.c
  7. BIN
      tests/test_etcp_100_packets
  8. 2
      tests/test_etcp_100_packets.c
  9. BIN
      tests/test_etcp_api
  10. 2
      tests/test_etcp_api.c
  11. BIN
      tests/test_etcp_simple_traffic
  12. 2
      tests/test_etcp_simple_traffic.c
  13. BIN
      tests/test_etcp_two_instances
  14. BIN
      tests/test_pkt_normalizer_etcp
  15. 2
      tests/test_pkt_normalizer_etcp.c
  16. 31
      tinycrypt/lib/source/ecc_platform_specific.c

26
build.sh

@ -96,17 +96,31 @@ fi
# Build
echo "Compiling with $JOBS..."
BUILD_SUCCESS=0
if [ "$IS_WINDOWS" -eq 1 ]; then
make $JOBS $MAKE_ARGS 2>&1 | tee build_win.log
if [ ${PIPESTATUS[0]} -eq 0 ]; then
BUILD_SUCCESS=1
fi
else
make $JOBS $MAKE_ARGS 2>&1 | tee build_linux.log
if [ ${PIPESTATUS[0]} -eq 0 ]; then
BUILD_SUCCESS=1
fi
fi
echo ""
echo "Build completed successfully!"
if [ "$IS_WINDOWS" -eq 1 ]; then
echo "Binary: src/utun.exe"
echo "Make sure wintun.dll is in the same directory as utun.exe"
if [ $BUILD_SUCCESS -eq 1 ]; then
echo ""
echo "Build completed successfully!"
if [ "$IS_WINDOWS" -eq 1 ]; then
echo "Binary: src/utun.exe"
echo "Make sure wintun.dll is in the same directory as utun.exe"
else
echo "Binary: src/utun"
fi
else
echo "Binary: src/utun"
echo ""
echo "ERROR: Build failed!"
echo "Check build_win.log (Windows) or build_linux.log (Linux) for details"
exit 1
fi

266
build_win.log

@ -2,250 +2,36 @@ make all-recursive
make[1]: Entering directory '/c/ARM/_uTun/utun2'
Making all in lib
make[2]: Entering directory '/c/ARM/_uTun/utun2/lib'
gcc -DHAVE_CONFIG_H -I. -I.. -D_ISOC99_SOURCE -DDEBUG_OUTPUT_STDERR -I../src -I../lib -g -O2 -MT libuasync_a-u_async.o -MD -MP -MF .deps/libuasync_a-u_async.Tpo -c -o libuasync_a-u_async.o `test -f 'u_async.c' || echo './'`u_async.c
gcc -DHAVE_CONFIG_H -I. -I.. -D_ISOC99_SOURCE -DDEBUG_OUTPUT_STDERR -I../src -I../lib -g -O2 -MT libuasync_a-ll_queue.o -MD -MP -MF .deps/libuasync_a-ll_queue.Tpo -c -o libuasync_a-ll_queue.o `test -f 'll_queue.c' || echo './'`ll_queue.c
gcc -DHAVE_CONFIG_H -I. -I.. -D_ISOC99_SOURCE -DDEBUG_OUTPUT_STDERR -I../src -I../lib -g -O2 -MT libuasync_a-debug_config.o -MD -MP -MF .deps/libuasync_a-debug_config.Tpo -c -o libuasync_a-debug_config.o `test -f 'debug_config.c' || echo './'`debug_config.c
mv -f .deps/libuasync_a-ll_queue.Tpo .deps/libuasync_a-ll_queue.Po
mv -f .deps/libuasync_a-debug_config.Tpo .deps/libuasync_a-debug_config.Po
mv -f .deps/libuasync_a-u_async.Tpo .deps/libuasync_a-u_async.Po
rm -f libuasync.a
ar cru libuasync.a libuasync_a-u_async.o libuasync_a-ll_queue.o libuasync_a-debug_config.o libuasync_a-timeout_heap.o libuasync_a-memory_pool.o libuasync_a-sha256.o libuasync_a-socket_compat.o
C:\msys64\ucrt64\bin\ar.exe: `u' modifier ignored since `D' is the default (see `U')
ranlib libuasync.a
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/c/ARM/_uTun/utun2/lib'
Making all in src
make[2]: Entering directory '/c/ARM/_uTun/utun2/src'
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-utun.o -MD -MP -MF .deps/utun-utun.Tpo -c -o utun-utun.o `test -f 'utun.c' || echo './'`utun.c
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-utun_instance.o -MD -MP -MF .deps/utun-utun_instance.Tpo -c -o utun-utun_instance.o `test -f 'utun_instance.c' || echo './'`utun_instance.c
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-config_parser.o -MD -MP -MF .deps/utun-config_parser.Tpo -c -o utun-config_parser.o `test -f 'config_parser.c' || echo './'`config_parser.c
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-config_updater.o -MD -MP -MF .deps/utun-config_updater.Tpo -c -o utun-config_updater.o `test -f 'config_updater.c' || echo './'`config_updater.c
In file included from config_parser.c:8:
config_parser.c: In function 'parse_debug_categories':
../lib/debug_config.h:52:36: warning: conversion from 'long long unsigned int' to 'uint32_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Woverflow]
52 | #define DEBUG_CATEGORY_ALL ((debug_category_t)0xFFFFFFFFFFFFFFFFULL)
| ^
config_parser.c:40:29: note: in expansion of macro 'DEBUG_CATEGORY_ALL'
40 | if (!value_copy) return DEBUG_CATEGORY_ALL; // Default to all on error
| ^~~~~~~~~~~~~~~~~~
../lib/debug_config.h:52:36: warning: conversion from 'long long unsigned int' to 'uint32_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Woverflow]
52 | #define DEBUG_CATEGORY_ALL ((debug_category_t)0xFFFFFFFFFFFFFFFFULL)
| ^
config_parser.c:68:27: note: in expansion of macro 'DEBUG_CATEGORY_ALL'
68 | categories |= DEBUG_CATEGORY_ALL;
| ^~~~~~~~~~~~~~~~~~
mv -f .deps/utun-utun.Tpo .deps/utun-utun.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-route_lib.o -MD -MP -MF .deps/utun-route_lib.Tpo -c -o utun-route_lib.o `test -f 'route_lib.c' || echo './'`route_lib.c
mv -f .deps/utun-utun_instance.Tpo .deps/utun-utun_instance.Po
In file included from route_lib.c:6:
route_lib.h:59:49: warning: 'struct ROUTE_TABLE' declared inside parameter list will not be visible outside of this definition or declaration
59 | typedef void (*route_change_callback_fn)(struct ROUTE_TABLE* table,
| ^~~~~~~~~~~
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-route_bgp.o -MD -MP -MF .deps/utun-route_bgp.Tpo -c -o utun-route_bgp.o `test -f 'route_bgp.c' || echo './'`route_bgp.c
mv -f .deps/utun-config_updater.Tpo .deps/utun-config_updater.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-routing.o -MD -MP -MF .deps/utun-routing.Tpo -c -o utun-routing.o `test -f 'routing.c' || echo './'`routing.c
mv -f .deps/utun-config_parser.Tpo .deps/utun-config_parser.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-tun_if.o -MD -MP -MF .deps/utun-tun_if.Tpo -c -o utun-tun_if.o `test -f 'tun_if.c' || echo './'`tun_if.c
In file included from routing.c:3:
route_lib.h:59:49: warning: 'struct ROUTE_TABLE' declared inside parameter list will not be visible outside of this definition or declaration
59 | typedef void (*route_change_callback_fn)(struct ROUTE_TABLE* table,
| ^~~~~~~~~~~
route_lib.c: In function 'route_table_insert':
route_lib.c:351:40: warning: passing argument 1 of 'table->change_callback' from incompatible pointer type [-Wincompatible-pointer-types]
351 | table->change_callback(table, &table->entries[i], 1, table->change_callback_arg);
| ^~~~~
| |
| struct ROUTE_TABLE *
route_lib.c:351:40: note: expected 'struct ROUTE_TABLE *' but argument is of type 'struct ROUTE_TABLE *'
route_lib.c:367:32: warning: passing argument 1 of 'table->change_callback' from incompatible pointer type [-Wincompatible-pointer-types]
367 | table->change_callback(table, &table->entries[table->count - 1], 0, table->change_callback_arg);
| ^~~~~
| |
| struct ROUTE_TABLE *
route_lib.c:367:32: note: expected 'struct ROUTE_TABLE *' but argument is of type 'struct ROUTE_TABLE *'
route_lib.c: In function 'route_table_delete_entry':
route_lib.c:457:32: warning: passing argument 1 of 'table->change_callback' from incompatible pointer type [-Wincompatible-pointer-types]
457 | table->change_callback(table, &table->entries[found_idx], 2, table->change_callback_arg);
| ^~~~~
| |
| struct ROUTE_TABLE *
route_lib.c:457:32: note: expected 'struct ROUTE_TABLE *' but argument is of type 'struct ROUTE_TABLE *'
In file included from route_bgp.c:16:
route_lib.h:59:49: warning: 'struct ROUTE_TABLE' declared inside parameter list will not be visible outside of this definition or declaration
59 | typedef void (*route_change_callback_fn)(struct ROUTE_TABLE* table,
| ^~~~~~~~~~~
route_bgp.c: In function 'route_bgp_init':
route_bgp.c:380:39: warning: assignment to 'route_change_callback_fn' {aka 'void (*)(struct ROUTE_TABLE *, struct ROUTE_ENTRY *, int, void *)'} from incompatible pointer type 'void (*)(struct ROUTE_TABLE *, struct ROUTE_ENTRY *, int, void *)' [-Wincompatible-pointer-types]
380 | instance->rt->change_callback = route_bgp_on_route_change;
| ^
route_bgp.c: In function 'route_bgp_destroy':
route_bgp.c:401:59: warning: comparison of distinct pointer types lacks a cast
401 | if (instance->rt && instance->rt->change_callback == route_bgp_on_route_change) {
| ^~
mv -f .deps/utun-route_lib.Tpo .deps/utun-route_lib.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-etcp.o -MD -MP -MF .deps/utun-etcp.Tpo -c -o utun-etcp.o `test -f 'etcp.c' || echo './'`etcp.c
mv -f .deps/utun-route_bgp.Tpo .deps/utun-route_bgp.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-etcp_connections.o -MD -MP -MF .deps/utun-etcp_connections.Tpo -c -o utun-etcp_connections.o `test -f 'etcp_connections.c' || echo './'`etcp_connections.c
mv -f .deps/utun-tun_if.Tpo .deps/utun-tun_if.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-etcp_loadbalancer.o -MD -MP -MF .deps/utun-etcp_loadbalancer.Tpo -c -o utun-etcp_loadbalancer.o `test -f 'etcp_loadbalancer.c' || echo './'`etcp_loadbalancer.c
mv -f .deps/utun-routing.Tpo .deps/utun-routing.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT utun-secure_channel.o -MD -MP -MF .deps/utun-secure_channel.Tpo -c -o utun-secure_channel.o `test -f 'secure_channel.c' || echo './'`secure_channel.c
etcp.c: In function 'etcp_connection_create':
etcp.c:112:22: warning: assignment to 'struct pn_pair *' from incompatible pointer type 'struct PKTNORM *' [-Wincompatible-pointer-types]
112 | etcp->normalizer = pn_init(etcp);
| ^
etcp_connections.c:4:10: fatal error: net/if.h: No such file or directory
4 | #include <net/if.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:735: utun-etcp_connections.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/utun-etcp.Tpo .deps/utun-etcp.Po
secure_channel.c: In function 'sc_generate_keypair':
secure_channel.c:134:5: warning: 'EC_KEY_new' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
134 | EC_KEY *key = EC_KEY_new();
| ^~~~~~
In file included from secure_channel.c:25:
C:/msys64/ucrt64/include/openssl/ec.h:971:31: note: declared here
971 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void);
| ^~~~~~~~~~
secure_channel.c:139:5: warning: 'EC_KEY_set_group' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
139 | if (EC_KEY_set_group(key, group) != 1) {
| ^~
C:/msys64/ucrt64/include/openssl/ec.h:1045:27: note: declared here
1045 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
| ^~~~~~~~~~~~~~~~
secure_channel.c:140:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
140 | EC_KEY_free(key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:145:5: warning: 'EC_KEY_generate_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
145 | if (EC_KEY_generate_key(key) != 1) {
| ^~
C:/msys64/ucrt64/include/openssl/ec.h:1104:27: note: declared here
1104 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_generate_key(EC_KEY *key);
| ^~~~~~~~~~~~~~~~~~~
secure_channel.c:146:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
146 | EC_KEY_free(key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:150:5: warning: 'EC_KEY_get0_private_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
150 | const BIGNUM *priv = EC_KEY_get0_private_key(key);
| ^~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1051:37: note: declared here
1051 | OSSL_DEPRECATEDIN_3_0 const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);
| ^~~~~~~~~~~~~~~~~~~~~~~
secure_channel.c:152:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
152 | EC_KEY_free(key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:156:5: warning: 'EC_KEY_get0_public_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
156 | const EC_POINT *pub_point = EC_KEY_get0_public_key(key);
| ^~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1065:39: note: declared here
1065 | OSSL_DEPRECATEDIN_3_0 const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
| ^~~~~~~~~~~~~~~~~~~~~~
secure_channel.c:159:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
159 | EC_KEY_free(key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
mv -f .deps/utun-etcp_loadbalancer.Tpo .deps/utun-etcp_loadbalancer.Po
secure_channel.c:164:5: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
164 | EC_KEY_free(key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c: In function 'sc_set_peer_public_key':
secure_channel.c:220:5: warning: 'EC_KEY_new' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
220 | EC_KEY *my_key = EC_KEY_new();
| ^~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:971:31: note: declared here
971 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void);
| ^~~~~~~~~~
secure_channel.c:225:5: warning: 'EC_KEY_set_group' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
225 | if (EC_KEY_set_group(my_key, group) != 1) {
| ^~
C:/msys64/ucrt64/include/openssl/ec.h:1045:27: note: declared here
1045 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
| ^~~~~~~~~~~~~~~~
secure_channel.c:226:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
226 | EC_KEY_free(my_key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:231:5: warning: 'EC_KEY_set_private_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
231 | if (!my_priv || EC_KEY_set_private_key(my_key, my_priv) != 1) {
| ^~
C:/msys64/ucrt64/include/openssl/ec.h:1059:27: note: declared here
1059 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
| ^~~~~~~~~~~~~~~~~~~~~~
secure_channel.c:233:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
233 | EC_KEY_free(my_key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:240:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
240 | EC_KEY_free(my_key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:251:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
251 | EC_KEY_free(my_key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:256:5: warning: 'ECDH_compute_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
256 | int len = ECDH_compute_key(shared_secret, SC_SHARED_SECRET_SIZE, peer_point, my_key, NULL);
| ^~~
C:/msys64/ucrt64/include/openssl/ec.h:1299:27: note: declared here
1299 | OSSL_DEPRECATEDIN_3_0 int ECDH_compute_key(void *out, size_t outlen,
| ^~~~~~~~~~~~~~~~
secure_channel.c:263:9: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
263 | EC_KEY_free(my_key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c:275:5: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
275 | EC_KEY_free(my_key);
| ^~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/ec.h:1006:28: note: declared here
1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
| ^~~~~~~~~~~
secure_channel.c: In function 'sc_build_nonce':
secure_channel.c:306:5: warning: 'SHA256_Init' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
306 | SHA256_Init(&sha_ctx);
| ^~~~~~~~~~~
In file included from secure_channel.c:27:
C:/msys64/ucrt64/include/openssl/sha.h:73:27: note: declared here
73 | OSSL_DEPRECATEDIN_3_0 int SHA256_Init(SHA256_CTX *c);
| ^~~~~~~~~~~
secure_channel.c:307:5: warning: 'SHA256_Update' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
307 | SHA256_Update(&sha_ctx, data, 24);
| ^~~~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/sha.h:74:27: note: declared here
74 | OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c,
| ^~~~~~~~~~~~~
secure_channel.c:308:5: warning: 'SHA256_Final' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
308 | SHA256_Final(hash, &sha_ctx);
| ^~~~~~~~~~~~
C:/msys64/ucrt64/include/openssl/sha.h:76:27: note: declared here
76 | OSSL_DEPRECATEDIN_3_0 int SHA256_Final(unsigned char *md, SHA256_CTX *c);
| ^~~~~~~~~~~~
mv -f .deps/utun-secure_channel.Tpo .deps/utun-secure_channel.Po
make[2]: Leaving directory '/c/ARM/_uTun/utun2/src'
Making all in tests
make[2]: Entering directory '/c/ARM/_uTun/utun2/tests'
cd .. && /bin/sh /c/ARM/_uTun/utun2/build-aux/missing automake-1.16 --foreign tests/Makefile
cd .. && /bin/sh ./config.status tests/Makefile depfiles
config.status: creating tests/Makefile
config.status: executing depfiles commands
make all-am
make[3]: Entering directory '/c/ARM/_uTun/utun2/tests'
x86_64-w64-mingw32-gcc -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -o test_etcp_crypto.exe test_etcp_crypto-test_etcp_crypto.o ../src/utun-secure_channel.o ../src/utun-crc32.o -lcrypto ../lib/libuasync.a -lpthread -lws2_32 -liphlpapi -lcrypto
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT test_etcp_two_instances-test_etcp_two_instances.o -MD -MP -MF .deps/test_etcp_two_instances-test_etcp_two_instances.Tpo -c -o test_etcp_two_instances-test_etcp_two_instances.o `test -f 'test_etcp_two_instances.c' || echo './'`test_etcp_two_instances.c
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 -lcrypto
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../lib -I../tinycrypt/lib/include -I../tinycrypt/lib/source -g -O2 -MT test_etcp_simple_traffic-test_etcp_simple_traffic.o -MD -MP -MF .deps/test_etcp_simple_traffic-test_etcp_simple_traffic.Tpo -c -o test_etcp_simple_traffic-test_etcp_simple_traffic.o `test -f 'test_etcp_simple_traffic.c' || echo './'`test_etcp_simple_traffic.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....
test_etcp_simple_traffic.c: In function 'create_temp_configs':
test_etcp_simple_traffic.c:71:32: warning: comparison between pointer and integer
71 | if (test_mkdtemp(temp_dir) == NULL) {
| ^~
mv -f .deps/test_etcp_two_instances-test_etcp_two_instances.Tpo .deps/test_etcp_two_instances-test_etcp_two_instances.Po
mv -f .deps/test_etcp_simple_traffic-test_etcp_simple_traffic.Tpo .deps/test_etcp_simple_traffic-test_etcp_simple_traffic.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'
make[1]: *** [Makefile:379: all-recursive] Error 1
make[1]: Leaving directory '/c/ARM/_uTun/utun2'
make: *** [Makefile:320: all] Error 2

BIN
tests/test_bgp_route_exchange

Binary file not shown.

2
tests/test_bgp_route_exchange.c

@ -76,7 +76,7 @@ static int create_temp_directory(void) {
}
return -1; // Failed after 100 attempts
#else
return (test_mkdtemp(temp_dir) == NULL) ? -1 : 0;
return (test_mkdtemp(temp_dir) != 0) ? -1 : 0;
#endif
}

BIN
tests/test_config_debug

Binary file not shown.

2
tests/test_config_debug.c

@ -44,7 +44,7 @@ static const char* config_content =
// Create temp config file
static int create_temp_config(void) {
if (test_mkdtemp(temp_dir) == NULL) {
if (test_mkdtemp(temp_dir) != 0) {
fprintf(stderr, "Failed to create temp directory\n");
return -1;
}

BIN
tests/test_etcp_100_packets

Binary file not shown.

2
tests/test_etcp_100_packets.c

@ -70,7 +70,7 @@ static const char* client_config_content =
// Create temp config files
static int create_temp_configs(void) {
if (test_mkdtemp(temp_dir) == NULL) {
if (test_mkdtemp(temp_dir) != 0) {
fprintf(stderr, "Failed to create temp directory\n");
return -1;
}

BIN
tests/test_etcp_api

Binary file not shown.

2
tests/test_etcp_api.c

@ -77,7 +77,7 @@ static const char* client_config_content =
// Create temp config files
static int create_temp_configs(void) {
if (test_mkdtemp(temp_dir) == NULL) {
if (test_mkdtemp(temp_dir) != 0) {
fprintf(stderr, "Failed to create temp directory\n");
return -1;
}

BIN
tests/test_etcp_simple_traffic

Binary file not shown.

2
tests/test_etcp_simple_traffic.c

@ -68,7 +68,7 @@ static const char* client_config_content =
// Create temp config files
static int create_temp_configs(void) {
if (test_mkdtemp(temp_dir) == NULL) {
if (test_mkdtemp(temp_dir) != 0) {
fprintf(stderr, "Failed to create temp directory\n");
return -1;
}

BIN
tests/test_etcp_two_instances

Binary file not shown.

BIN
tests/test_pkt_normalizer_etcp

Binary file not shown.

2
tests/test_pkt_normalizer_etcp.c

@ -71,7 +71,7 @@ static const char* client_config_content =
// Create temp config files
static int create_temp_configs(void) {
if (test_mkdtemp(temp_dir) == NULL) {
if (test_mkdtemp(temp_dir) != 0) {
fprintf(stderr, "Failed to create temp directory\n");
return -1;
}

31
tinycrypt/lib/source/ecc_platform_specific.c

@ -101,5 +101,36 @@ int default_CSPRNG(uint8_t *dest, unsigned int size) {
return 1;
}
#elif defined(_WIN32)
/* Windows implementation using CryptGenRandom */
#include <windows.h>
#include <wincrypt.h>
int default_CSPRNG(uint8_t *dest, unsigned int size) {
/* input sanity check: */
if (dest == (uint8_t *) 0 || (size <= 0))
return 0;
HCRYPTPROV hProvider = 0;
if (!CryptAcquireContext(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
return 0;
}
BOOL result = CryptGenRandom(hProvider, size, dest);
CryptReleaseContext(hProvider, 0);
return result ? 1 : 0;
}
#else
/* No CSPRNG available - return error */
int default_CSPRNG(uint8_t *dest, unsigned int size) {
(void)dest;
(void)size;
return 0;
}
#endif /* platform */

Loading…
Cancel
Save