mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-20 03:44:15 +08:00
Remove warnings on Windows
This commit is contained in:
@@ -622,7 +622,7 @@ add_library(gmssl ${src})
|
|||||||
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(gmssl -lws2_32)
|
target_link_libraries(gmssl PRIVATE Ws2_32)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
if (ENABLE_SDF)
|
if (ENABLE_SDF)
|
||||||
target_link_libraries(gmssl dl)
|
target_link_libraries(gmssl dl)
|
||||||
@@ -664,7 +664,7 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
|
|||||||
add_executable(gmssl-bin ${tools})
|
add_executable(gmssl-bin ${tools})
|
||||||
target_link_libraries(gmssl-bin LINK_PUBLIC gmssl)
|
target_link_libraries(gmssl-bin LINK_PUBLIC gmssl)
|
||||||
set_target_properties(gmssl-bin PROPERTIES RUNTIME_OUTPUT_NAME gmssl)
|
set_target_properties(gmssl-bin PROPERTIES RUNTIME_OUTPUT_NAME gmssl)
|
||||||
if (MINGW)
|
if (WIN32)
|
||||||
target_link_libraries(gmssl-bin PRIVATE Ws2_32)
|
target_link_libraries(gmssl-bin PRIVATE Ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
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;
|
SM2_CIPHERTEXT ciphertext;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!ctx || !public_key || !outlen) {
|
if (!ctx || !public_key || !outlen) {
|
||||||
error_print();
|
error_print();
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ bad:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hex) {
|
if (hex) {
|
||||||
int i;
|
size_t i;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
fprintf(outfp, "%02X", buf[i]);
|
fprintf(outfp, "%02X", buf[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ int sdfdecrypt_main(int argc, char **argv)
|
|||||||
SDF_CBC_CTX ctx;
|
SDF_CBC_CTX ctx;
|
||||||
const uint8_t *p;
|
const uint8_t *p;
|
||||||
SM2_CIPHERTEXT ciphertext;
|
SM2_CIPHERTEXT ciphertext;
|
||||||
uint8_t *wrappedkey;
|
|
||||||
size_t wrappedkey_len;
|
size_t wrappedkey_len;
|
||||||
|
|
||||||
memset(&dev, 0, sizeof(dev));
|
memset(&dev, 0, sizeof(dev));
|
||||||
|
|||||||
@@ -2033,8 +2033,6 @@ static int speed_SDF_InternalEncrypt_ECC(int key)
|
|||||||
unsigned char ucData[32] = {1}; // same as sm2_enctest.c
|
unsigned char ucData[32] = {1}; // same as sm2_enctest.c
|
||||||
unsigned int uiDataLength = (unsigned int)sizeof(ucData);
|
unsigned int uiDataLength = (unsigned int)sizeof(ucData);
|
||||||
ECCCipher eccCipher;
|
ECCCipher eccCipher;
|
||||||
unsigned char ucDecData[256];
|
|
||||||
unsigned int uiDecDataLength;
|
|
||||||
clock_t begin, end;
|
clock_t begin, end;
|
||||||
double seconds;
|
double seconds;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|||||||
@@ -597,7 +597,11 @@ bad:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(hp = gethostbyname(host))) {
|
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));
|
fprintf(stderr, "%s: parse -host value error: %s\n", prog, hstrerror(h_errno));
|
||||||
|
#endif
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
server.sin_addr = *((struct in_addr *)hp->h_addr_list[0]);
|
server.sin_addr = *((struct in_addr *)hp->h_addr_list[0]);
|
||||||
|
|||||||
@@ -456,9 +456,6 @@ bad:
|
|||||||
puts("start listen ...\n");
|
puts("start listen ...\n");
|
||||||
tls_socket_listen(sock, 1);
|
tls_socket_listen(sock, 1);
|
||||||
|
|
||||||
|
|
||||||
restart:
|
|
||||||
|
|
||||||
//client_addrlen = sizeof(client_addr);
|
//client_addrlen = sizeof(client_addr);
|
||||||
if (tls_socket_accept(sock, &client_addr, &conn_sock) != 1) {
|
if (tls_socket_accept(sock, &client_addr, &conn_sock) != 1) {
|
||||||
fprintf(stderr, "%s: socket accept error\n", prog);
|
fprintf(stderr, "%s: socket accept error\n", prog);
|
||||||
|
|||||||
Reference in New Issue
Block a user