Fixed windows linking
This commit is contained in:
parent
542ffdc62c
commit
cab68d412f
4
.build_win32_amd64.txt
Normal file
4
.build_win32_amd64.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
1
|
||||||
|
success
|
||||||
|
542ffdc62c3efd2f659a1c14f3a15fe54c83e643
|
||||||
|
06 Jul 2019 22:26:45
|
@ -26,6 +26,19 @@ else()
|
|||||||
set(SOURCE ${SOURCE} src/sha512.c)
|
set(SOURCE ${SOURCE} src/sha512.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set(CompilerFlags
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
)
|
||||||
|
foreach(CompilerFlag ${CompilerFlags})
|
||||||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
#Some programs need for full support the header files too
|
#Some programs need for full support the header files too
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
include/ed25519.h
|
include/ed25519.h
|
||||||
|
@ -13,25 +13,34 @@ typedef struct sha512_functions_ {
|
|||||||
int(*_ed_sha512_update)(sha512_context*, const unsigned char *, size_t);
|
int(*_ed_sha512_update)(sha512_context*, const unsigned char *, size_t);
|
||||||
} sha512_functions;
|
} sha512_functions;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
extern sha512_functions _ed_sha512_functions;
|
extern sha512_functions _ed_sha512_functions;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
inline void _ed_sha512_validate() {
|
inline void _ed_sha512_validate() {
|
||||||
assert(_ed_sha512_functions._ed_sha512_init);
|
assert(_ed_sha512_functions._ed_sha512_init);
|
||||||
assert(_ed_sha512_functions._ed_sha512_final);
|
assert(_ed_sha512_functions._ed_sha512_final);
|
||||||
assert(_ed_sha512_functions._ed_sha512_update);
|
assert(_ed_sha512_functions._ed_sha512_update);
|
||||||
}
|
}
|
||||||
inline int _ed_sha512(const unsigned char *message, size_t message_len, unsigned char *out) {
|
inline int _ed_sha512(const unsigned char *message, size_t message_len, unsigned char *out) {
|
||||||
_ed_sha512_validate();
|
_ed_sha512_validate();
|
||||||
|
|
||||||
int result = 1;
|
int result = 1;
|
||||||
sha512_context ctx;
|
sha512_context ctx;
|
||||||
result &= _ed_sha512_functions._ed_sha512_init(&ctx);
|
result &= _ed_sha512_functions._ed_sha512_init(&ctx);
|
||||||
result &= _ed_sha512_functions._ed_sha512_update(&ctx, message, message_len);
|
result &= _ed_sha512_functions._ed_sha512_update(&ctx, message, message_len);
|
||||||
result &= _ed_sha512_functions._ed_sha512_final(&ctx, out);
|
result &= _ed_sha512_functions._ed_sha512_final(&ctx, out);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user