keys: yk: Add YubiKey hardware driver support

* Use compile time detection of the YubiKey libraries and link against
  the libraries if present.  Can be disabled with:

      $ cmake -DCMAKE_DISABLE_FIND_PACKAGE_YubiKey=FALSE

* A stub file provides empty calls for all the function calls integrated
  in to the UI to support this.  In the future a more modular approach
  maybe better, but opting for simplicity initially.

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
This commit is contained in:
Kyle Manna 2014-05-26 00:41:54 -07:00
parent add4846d79
commit 82aed2caab
6 changed files with 434 additions and 0 deletions

View file

@ -111,6 +111,7 @@ set(keepassx_SOURCES
gui/group/GroupView.cpp
keys/CompositeKey.cpp
keys/CompositeKey_p.h
keys/drivers/YubiKey.h
keys/FileKey.cpp
keys/Key.h
keys/PasswordKey.cpp
@ -190,6 +191,12 @@ if(MINGW)
${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
endif()
if(YUBIKEY_FOUND)
set(keepassx_SOURCES ${keepassx_SOURCES} keys/drivers/YubiKey.cpp)
else()
set(keepassx_SOURCES ${keepassx_SOURCES} keys/drivers/YubiKeyStub.cpp)
endif()
qt5_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
add_library(zxcvbn STATIC zxcvbn/zxcvbn.cpp)
@ -220,6 +227,10 @@ target_link_libraries(${PROGNAME}
${GCRYPT_LIBRARIES}
${ZLIB_LIBRARIES})
if(YUBIKEY_FOUND)
target_link_libraries(keepassx_core ${YUBIKEY_LIBRARIES})
endif()
set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON)
if(APPLE)