Remove warnings on Windows

This commit is contained in:
Zhi Guan
2026-05-27 22:07:03 +08:00
parent efddfc5ac5
commit 2c0053dd85
7 changed files with 9 additions and 9 deletions

View File

@@ -622,7 +622,7 @@ add_library(gmssl ${src})
if (WIN32)
target_link_libraries(gmssl -lws2_32)
target_link_libraries(gmssl PRIVATE Ws2_32)
elseif (APPLE)
if (ENABLE_SDF)
target_link_libraries(gmssl dl)
@@ -664,7 +664,7 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
add_executable(gmssl-bin ${tools})
target_link_libraries(gmssl-bin LINK_PUBLIC gmssl)
set_target_properties(gmssl-bin PROPERTIES RUNTIME_OUTPUT_NAME gmssl)
if (MINGW)
if (WIN32)
target_link_libraries(gmssl-bin PRIVATE Ws2_32)
endif()

View File

@@ -570,7 +570,9 @@ int sm2_encrypt_update(SM2_ENC_CTX *ctx, const uint8_t *in, size_t inlen)
int sm2_encrypt_finish(SM2_ENC_CTX *ctx, const SM2_KEY *public_key, uint8_t *out, size_t *outlen)
{
#if ENABLE_SM2_ENC_PRE_COMPUTE
SM2_CIPHERTEXT ciphertext;
#endif
if (!ctx || !public_key || !outlen) {
error_print();

View File

@@ -110,7 +110,7 @@ bad:
}
if (hex) {
int i;
size_t i;
for (i = 0; i < len; i++) {
fprintf(outfp, "%02X", buf[i]);
}

View File

@@ -61,7 +61,6 @@ int sdfdecrypt_main(int argc, char **argv)
SDF_CBC_CTX ctx;
const uint8_t *p;
SM2_CIPHERTEXT ciphertext;
uint8_t *wrappedkey;
size_t wrappedkey_len;
memset(&dev, 0, sizeof(dev));

View File

@@ -2033,8 +2033,6 @@ static int speed_SDF_InternalEncrypt_ECC(int key)
unsigned char ucData[32] = {1}; // same as sm2_enctest.c
unsigned int uiDataLength = (unsigned int)sizeof(ucData);
ECCCipher eccCipher;
unsigned char ucDecData[256];
unsigned int uiDecDataLength;
clock_t begin, end;
double seconds;
int i, ret;

View File

@@ -597,7 +597,11 @@ bad:
}
if (!(hp = gethostbyname(host))) {
#ifdef WIN32
fprintf(stderr, "%s: parse -host value error: %d\n", prog, WSAGetLastError());
#else
fprintf(stderr, "%s: parse -host value error: %s\n", prog, hstrerror(h_errno));
#endif
goto end;
}
server.sin_addr = *((struct in_addr *)hp->h_addr_list[0]);

View File

@@ -456,9 +456,6 @@ bad:
puts("start listen ...\n");
tls_socket_listen(sock, 1);
restart:
//client_addrlen = sizeof(client_addr);
if (tls_socket_accept(sock, &client_addr, &conn_sock) != 1) {
fprintf(stderr, "%s: socket accept error\n", prog);