Skip to content

Commit

Permalink
fix window dll linker + build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav-thales committed Oct 9, 2024
1 parent f2a2b4d commit 3f481cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ endif()
add_executable(test_kem test_kem.c)
target_link_libraries(test_kem PRIVATE ${TEST_DEPS})

if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND BUILD_SHARED_LIBS)
# workaround for Windows .dll
if(MINGW OR MSYS OR CYGWIN OR CMAKE_CROSSCOMPILING)
target_link_options(test_kem PRIVATE -Wl,--allow-multiple-definition)
else()
target_link_options(test_kem PRIVATE "/FORCE:MULTIPLE")
endif()
endif()

add_executable(test_kem_mem test_kem_mem.c)
target_link_libraries(test_kem_mem PRIVATE ${TEST_DEPS})

Expand Down
7 changes: 6 additions & 1 deletion tests/test_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32)
#include <string.h>
#define strcasecmp _stricmp
#else
#include <strings.h>
#endif

#include <oqs/oqs.h>
#include <oqs/sha3.h>
Expand Down Expand Up @@ -136,7 +141,7 @@ static OQS_STATUS kem_test_correctness(const char *method_name) {
fprintf(stderr, "ERROR: malloc failed\n");
goto err;
}
// test rejection key by corrupting the private key
// test rejection key by corrupting the secret key
secret_key[0] += 1;
uint8_t shared_secret_r[32]; // expected output
memcpy(buff_z_c, &secret_key[kem->length_secret_key - 32], 32);
Expand Down

0 comments on commit 3f481cd

Please sign in to comment.