-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Add yubico-piv-tool along with libykcs11
- Loading branch information
Showing
10 changed files
with
192 additions
and
128 deletions.
There are no files selected for viewing
149 changes: 149 additions & 0 deletions
149
mingw-w64-yubico-piv-tool/0001-Separate-WIN32-and-MSVC-to-allow-for-MSYS2-gcc-build.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index fba5822..f0d6038 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -89,7 +89,6 @@ if(MSVC) | ||
|
||
set(BUILD_SHARED_LIBS ON) | ||
set(GENERATE_MAN_PAGES OFF) | ||
- set(LIBCRYPTO_LIBRARIES ${LIBCRYPTO_LIBRARIES} bcrypt) | ||
else() | ||
find_package (PkgConfig REQUIRED) | ||
|
||
@@ -105,6 +104,10 @@ else() | ||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer") | ||
endif() | ||
|
||
+if(WIN32) | ||
+ set(LIBCRYPTO_LIBRARIES ${LIBCRYPTO_LIBRARIES} bcrypt) | ||
+endif(WIN32) | ||
+ | ||
# Use -Wshorten-64-to-32 if available. | ||
check_c_compiler_flag("-Wshorten-64-to-32" HAVE_SHORTEN_64_TO_32) | ||
if(HAVE_SHORTEN_64_TO_32) | ||
diff --git a/cmake/check.cmake b/cmake/check.cmake | ||
index 0c6085a..00648a3 100644 | ||
--- a/cmake/check.cmake | ||
+++ b/cmake/check.cmake | ||
@@ -26,7 +26,7 @@ | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
macro (find_check) | ||
- if(WIN32) | ||
+ if(MSVC) | ||
|
||
if(NOT check_FOUND) | ||
find_package(check CONFIG PATHS ${CHECK_PATH}) | ||
@@ -49,7 +49,7 @@ macro (find_check) | ||
endif(check_FOUND) | ||
endif(NOT check_FOUND) | ||
|
||
- else(WIN32) | ||
+ else(MSVC) | ||
|
||
if(NOT LIBCHECK_FOUND) | ||
pkg_check_modules(LIBCHECK REQUIRED check) | ||
@@ -73,7 +73,7 @@ macro (find_check) | ||
endif(LIBCHECK_FOUND) | ||
endif(NOT LIBCHECK_FOUND) | ||
|
||
- endif(WIN32) | ||
+ endif(MSVC) | ||
|
||
include_directories(${LIBCHECK_INCLUDE_DIRS}) | ||
|
||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt | ||
index f13526a..c7b7cd0 100644 | ||
--- a/lib/CMakeLists.txt | ||
+++ b/lib/CMakeLists.txt | ||
@@ -77,11 +77,11 @@ set_target_properties(ykpiv_shared PROPERTIES SOVERSION ${SO_VERSION} VERSION ${ | ||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
set_target_properties(ykpiv_shared PROPERTIES INSTALL_RPATH "${YKPIV_INSTALL_LIB_DIR}") | ||
endif() | ||
-if(WIN32) | ||
+if(MSVC) | ||
set_target_properties(ykpiv_shared PROPERTIES OUTPUT_NAME libykpiv) | ||
-else(WIN32) | ||
+else(MSVC) | ||
set_target_properties(ykpiv_shared PROPERTIES OUTPUT_NAME ykpiv) | ||
-endif(WIN32) | ||
+endif(MSVC) | ||
add_coverage(ykpiv_shared) | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ykpiv.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/ykpiv.pc @ONLY) | ||
diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt | ||
index f0e6de5..acbe03c 100644 | ||
--- a/tool/CMakeLists.txt | ||
+++ b/tool/CMakeLists.txt | ||
@@ -32,7 +32,7 @@ set (SOURCE | ||
../common/openssl-compat.c | ||
../common/util.c) | ||
|
||
-if(WIN32) | ||
+if(MSVC) | ||
add_definitions (-DPACKAGE="yubico-piv-tool") | ||
add_definitions (-DVERSION="${yubico_piv_tool_VERSION_MAJOR}.${yubico_piv_tool_VERSION_MINOR}.${yubico_piv_tool_VERSION_PATCH}") | ||
|
||
@@ -45,12 +45,12 @@ if(WIN32) | ||
include_directories(${ZLIB_INCL_DIR}) | ||
|
||
set(LINK_LIBS_WIN ${GETOPT} ${ZLIB}) | ||
-else(WIN32) | ||
+else(MSVC) | ||
include(${CMAKE_SOURCE_DIR}/cmake/gengetopt.cmake) | ||
find_gengetopt() | ||
add_gengetopt_files(cmdline) | ||
set(SOURCE ${SOURCE} ${GGO_C}) | ||
-endif(WIN32) | ||
+endif(MSVC) | ||
|
||
include_directories ( | ||
${CMAKE_SOURCE_DIR}/lib | ||
diff --git a/tool/tests/test_inout.c b/tool/tests/test_inout.c | ||
index 3a297eb..e59ddcc 100644 | ||
--- a/tool/tests/test_inout.c | ||
+++ b/tool/tests/test_inout.c | ||
@@ -38,7 +38,11 @@ | ||
#include "../../common/util.h" | ||
|
||
#ifdef _WIN32 | ||
+#ifdef _MSC_VER | ||
#include <openssl/applink.c> | ||
+#else | ||
+#include <io.h> | ||
+#endif | ||
#define pipe(fds) _pipe(fds,4096, 0) | ||
#else | ||
#include <unistd.h> | ||
diff --git a/tool/yubico-piv-tool.c b/tool/yubico-piv-tool.c | ||
index 9fc0d65..7ec0966 100644 | ||
--- a/tool/yubico-piv-tool.c | ||
+++ b/tool/yubico-piv-tool.c | ||
@@ -39,7 +39,7 @@ | ||
|
||
#include "ykpiv.h" | ||
|
||
-#ifdef _WIN32 | ||
+#ifdef _MSC_VER | ||
#include <windows.h> | ||
#include <openssl/applink.c> | ||
#else | ||
diff --git a/ykcs11/CMakeLists.txt b/ykcs11/CMakeLists.txt | ||
index 01670eb..9cf2ef6 100644 | ||
--- a/ykcs11/CMakeLists.txt | ||
+++ b/ykcs11/CMakeLists.txt | ||
@@ -78,11 +78,11 @@ set_target_properties(ykcs11_shared PROPERTIES SOVERSION ${SO_VERSION} VERSION $ | ||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
set_target_properties(ykcs11_shared PROPERTIES INSTALL_RPATH "${YKPIV_INSTALL_LIB_DIR}") | ||
endif() | ||
-if(WIN32) | ||
+if(MSVC) | ||
set_target_properties(ykcs11_shared PROPERTIES OUTPUT_NAME libykcs11) | ||
-else(WIN32) | ||
+else(MSVC) | ||
set_target_properties(ykcs11_shared PROPERTIES OUTPUT_NAME ykcs11) | ||
-endif(WIN32) | ||
+endif(MSVC) | ||
add_coverage(ykcs11_shared) | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ykcs11.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/ykcs11.pc @ONLY) |
30 changes: 30 additions & 0 deletions
30
mingw-w64-yubico-piv-tool/0002-Extra-define-and-cast-away-const-for-BCryptDeriveKey.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index f0d6038..17908d4 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -59,6 +59,10 @@ add_definitions(-DOPENSSL_API_COMPAT=0x10000000L) | ||
|
||
if(WIN32) | ||
add_definitions(-DWIN32_LEAN_AND_MEAN) | ||
+ if(NOT MSVC) | ||
+ # needed for BCRYPT_HMAC_SHA1_ALG_HANDLE in lib/internal.c | ||
+ add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN10) | ||
+ endif(NOT MSVC) | ||
set(_WIN32 ${WIN32}) | ||
endif() | ||
|
||
diff --git a/lib/internal.c b/lib/internal.c | ||
index deb7a8c..d6efce0 100644 | ||
--- a/lib/internal.c | ||
+++ b/lib/internal.c | ||
@@ -374,9 +374,7 @@ pkcs5_rc pkcs5_pbkdf2_sha1(const uint8_t* password, const size_t cb_password, co | ||
** PFN_BCryptDeriveKeyPBKDF2 pbkdf2 = GetProcAddress(hBCrypt, "BCryptDeriveKeyPBKDF2"); | ||
*/ | ||
|
||
- /* suppress const qualifier warning b/c BCrypt doesn't take const input buffers */ | ||
-#pragma warning(suppress: 4090) | ||
- if (!BCRYPT_SUCCESS(BCryptDeriveKeyPBKDF2(BCRYPT_HMAC_SHA1_ALG_HANDLE, (PUCHAR)password, (ULONG)cb_password, (PUCHAR)salt, (ULONG)cb_salt, iterations, key, (ULONG)cb_key, 0))) | ||
+ if (!BCRYPT_SUCCESS(BCryptDeriveKeyPBKDF2(BCRYPT_HMAC_SHA1_ALG_HANDLE, (PUCHAR)password, (ULONG)cb_password, (PUCHAR)salt, (ULONG)cb_salt, iterations, (PUCHAR)key, (ULONG)cb_key, 0))) | ||
{ | ||
rc = PKCS5_GENERAL_ERROR; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Yubico PKCS#11 PIV Library | ||
module: ..\..\bin\libykcs11.dll |
This file was deleted.
Oops, something went wrong.