Skip to content

Commit f1291ad

Browse files
committed
Fix broken build with NSS crypto back end
OpenSCAP had 2 alternatives of crypto libraries, GCrypt and NSS. GCrypt is the default backend. We discovered that building with the NSS backend is broken at this moment. This patch fixes the broken build. Use `cmake -DWITH_CRYPTO=nss ..` to configure with NSS.
1 parent 192f545 commit f1291ad

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP)
176176
check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP)
177177

178178
# WITH_CRYPTO
179-
set(WITH_CRYPTO "gcrypt" CACHE STRING "gcrypt|nss3")
180-
if(NOT (${WITH_CRYPTO} EQUAL "nss3"))
181-
# gcrypt
182-
find_package(GCrypt)
183-
else()
184-
# nss3
179+
set(WITH_CRYPTO "gcrypt" CACHE STRING "gcrypt|nss")
180+
if(${WITH_CRYPTO} STREQUAL "nss")
181+
message("-- Using NSS")
185182
find_package(NSS)
183+
else()
184+
message("-- Using GCrypt")
185+
find_package(GCrypt)
186186
endif()
187187
if(GCRYPT_FOUND OR NSS_FOUND)
188188
set(CRYPTO_FOUND TRUE)

cmake/FindNSS.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# Redistribution and use is allowed according to the terms of the BSD license.
1212
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
1313

14-
include(FindLibraryWithDebug)
15-
1614
if (NSS_LIBRARIES)
1715
set(NSS_FIND_QUIETLY TRUE)
1816
endif ()

config.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#cmakedefine HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG
2020
#endif
2121

22-
#cmakedefine NSS3_FOUND
23-
#if defined(NSS3_FOUND)
22+
#cmakedefine NSS_FOUND
23+
#if defined(NSS_FOUND)
2424
#define HAVE_NSS3
2525
#endif
2626

tests/API/crypt/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ set(CRAPI_HEADERS "${CMAKE_SOURCE_DIR}/src/OVAL/probes/crapi/")
33
file(GLOB_RECURSE CRAPI_SOURCES "${CMAKE_SOURCE_DIR}/src/OVAL/probes/crapi/*.c")
44
add_oscap_test_executable(test_crapi_digest "test_crapi_digest.c" ${CRAPI_SOURCES})
55
add_oscap_test_executable(test_crapi_mdigest "test_crapi_mdigest.c" ${CRAPI_SOURCES})
6-
target_include_directories(test_crapi_digest PUBLIC ${PROBE_HEADERS} ${CRAPI_HEADERS})
7-
target_include_directories(test_crapi_mdigest PUBLIC ${PROBE_HEADERS} ${CRAPI_HEADERS})
6+
target_include_directories(test_crapi_digest PUBLIC ${PROBE_HEADERS} ${CRAPI_HEADERS} ${NSS_INCLUDE_DIRS})
7+
target_include_directories(test_crapi_mdigest PUBLIC ${PROBE_HEADERS} ${CRAPI_HEADERS} ${NSS_INCLUDE_DIRS})
88
target_link_libraries(test_crapi_digest openscap)
99
target_link_libraries(test_crapi_mdigest openscap)
1010
add_oscap_test("test_api_crypt.sh")

0 commit comments

Comments
 (0)