cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(onak VERSION 0.6.0 LANGUAGES C)
+include(CheckSymbolExists)
include(FindPkgConfig)
include(GNUInstallDirs)
include(TestBigEndian)
target_include_directories(libonak SYSTEM PUBLIC
${GMP_INCLUDE_DIRS} ${HOGWEED_INCLUDE_DIRS})
LIST(APPEND LIBONAK_LIBRARIES ${GMP_LIBRARY} ${HOGWEED_LIBRARIES})
+
+ set(CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${NETTLE_LIBRARIES} ${HOGWEED_LIBRARIES})
+ # API change in later version of Nettle
+ CHECK_SYMBOL_EXISTS(nettle_get_secp_256r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_256R1)
+ CHECK_SYMBOL_EXISTS(nettle_get_secp_384r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_384R1)
+ CHECK_SYMBOL_EXISTS(nettle_get_secp_521r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_521R1)
endif()
# Build files that have substitutions in them
#cmakedefine HAVE_CRYPTO 1
#cmakedefine HAVE_NETTLE 1
+#cmakedefine HAVE_NETTLE_GET_SECP_256R1 1
+#cmakedefine HAVE_NETTLE_GET_SECP_384R1 1
+#cmakedefine HAVE_NETTLE_GET_SECP_521R1 1
#cmakedefine HAVE_SYSTEMD 1
#cmakedefine WORDS_BIGENDIAN 1
#include <nettle/rsa.h>
#include "rsa.h"
-#ifndef nettle_get_secp_256r1
+#ifndef HAVE_NETTLE_GET_SECP_256R1
#define nettle_get_secp_256r1() &nettle_secp_256r1
#endif
-#ifndef nettle_get_secp_384r1
+#ifndef HAVE_NETTLE_GET_SECP_384R1
#define nettle_get_secp_384r1() &nettle_secp_384r1
#endif
-#ifndef nettle_get_secp_521r1
+#ifndef HAVE_NETTLE_GET_SECP_521R1
#define nettle_get_secp_521r1() &nettle_secp_521r1
#endif