From fa6fb83c87b51417442420f2a51b61fdccc7953e Mon Sep 17 00:00:00 2001 From: Sahana Prasad Date: Tue, 10 Dec 2019 18:19:59 +0100 Subject: [PATCH] cmake: Add new option for PKCS11 URI support Signed-off-by: Sahana Prasad Reviewed-by: Jakub Jelen Reviewed-by: Andreas Schneider --- CMakeLists.txt | 1 + ConfigureChecks.cmake | 11 +++++++++++ DefineOptions.cmake | 1 + config.h.cmake | 3 +++ 4 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8008fe25..6375f9dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,6 +226,7 @@ message(STATUS "Build shared library: ${BUILD_SHARED_LIBS}") message(STATUS "Unit testing: ${UNIT_TESTING}") message(STATUS "Client code testing: ${CLIENT_TESTING}") message(STATUS "Blowfish cipher support: ${WITH_BLOWFISH_CIPHER}") +message(STATUS "PKCS #11 URI support: ${WITH_PKCS11_URI}") set(_SERVER_TESTING OFF) if (WITH_SERVER) set(_SERVER_TESTING ${SERVER_TESTING}) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index a99278f7..ace00f38 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -467,6 +467,17 @@ if (WITH_GSSAPI AND NOT GSSAPI_FOUND) set(WITH_GSSAPI 0) endif (WITH_GSSAPI AND NOT GSSAPI_FOUND) +if (WITH_PKCS11_URI) + if (WITH_GCRYPT) + message(FATAL_ERROR "PKCS #11 is not supported for gcrypt.") + set(WITH_PKCS11_URI 0) + endif() + if (WITH_WITH_MBEDTLS) + message(FATAL_ERROR "PKCS #11 is not supported for mbedcrypto") + set(WITH_PKCS11_URI 0) + endif() +endif() + # ENDIAN if (NOT WIN32) test_big_endian(WORDS_BIGENDIAN) diff --git a/DefineOptions.cmake b/DefineOptions.cmake index b82a5018..59e8fb9b 100644 --- a/DefineOptions.cmake +++ b/DefineOptions.cmake @@ -11,6 +11,7 @@ option(WITH_BLOWFISH_CIPHER "Compile with blowfish support" OFF) option(WITH_PCAP "Compile with Pcap generation support" ON) option(WITH_INTERNAL_DOC "Compile doxygen internal documentation" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(WITH_PKCS11_URI "Build with PKCS#11 URI support" OFF) option(UNIT_TESTING "Build with unit tests" OFF) option(CLIENT_TESTING "Build with client tests; requires openssh" OFF) option(SERVER_TESTING "Build with server tests; requires openssh and dropbear" OFF) diff --git a/config.h.cmake b/config.h.cmake index 847fc579..83612f85 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -281,6 +281,9 @@ /* Define to 1 if you want to enable NaCl support */ #cmakedefine WITH_NACL 1 +/* Define to 1 if you want to enable PKCS #11 URI support */ +#cmakedefine WITH_PKCS11_URI 1 + /*************************** ENDIAN *****************************/ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most