Fix: segfault in ETCP tests and add wintun.dll to gitignore

- Fix segfault in ETCP tests by initializing uECC RNG in sc_init_local_keys()
- Fix segfault during cleanup by adding reference counting to socket_platform_cleanup()
- Add wintun.dll to .gitignore
- Update AGENTS.md and platform compatibility headers

All 19 tests now pass successfully.
This commit is contained in:
jeka committed 2026-02-16 23:36:50 +03:00
1 parent 7781c4676b
commit 3ab19094d0
7 files changed
+38 -62

No files matched your search

+21 -8
View File
@@ -8,20 +8,33 @@
#ifdef _WIN32
// ==================== Windows Implementation ====================
static int wsa_init_count = 0;
int socket_platform_init(void) {
WSADATA wsaData;
int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (result != 0) {
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "WSAStartup failed: %d", result);
return -1;
if (wsa_init_count == 0) {
WSADATA wsaData;
int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (result != 0) {
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "WSAStartup failed: %d", result);
return -1;
}
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "Winsock 2.2 initialized");
}
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "Winsock 2.2 initialized");
wsa_init_count++;
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "Winsock init count: %d", wsa_init_count);
return 0;
}
void socket_platform_cleanup(void) {
WSACleanup();
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "Winsock cleanup completed");
if (wsa_init_count > 0) {
wsa_init_count--;
if (wsa_init_count == 0) {
WSACleanup();
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "Winsock cleanup completed");
} else {
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "Winsock init count after cleanup: %d", wsa_init_count);
}
}
}
int socket_set_nonblocking(socket_t sock) {