Skip to content

Commit

Permalink
Replace the term SSL with TLS (#103)
Browse files Browse the repository at this point in the history
- Rename files to use 'tls' instead of 'ssl'.
- Rename ssl library and examples.
- Update API and functions to use tls instead of ssl.
- Update build and test flags.
  CMake builds accepts `ENABLE_TLS`.
  Make builds accepts `USE_TLS`.
- Update docs and migration guide.

Signed-off-by: Björn Svensson <[email protected]>
  • Loading branch information
bjosv authored Sep 26, 2024
1 parent a79c564 commit 1c57bf6
Show file tree
Hide file tree
Showing 28 changed files with 415 additions and 422 deletions.
1 change: 0 additions & 1 deletion .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ Sanfilippo
SHA
sharding
SONAME
SSL
struct
structs
stunnel
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:
- name: Build using cmake
env:
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_TLS:BOOL=ON
run: mkdir build && cd build && cmake3 .. && make

- name: Build using Makefile
run: USE_SSL=1 TEST_ASYNC=1 make
run: USE_TLS=1 TEST_ASYNC=1 make

- name: Run tests
working-directory: tests
env:
SKIPS_AS_FAILS: 1
TEST_SSL: 1
TEST_TLS: 1
run: ./test.sh

centos8:
Expand All @@ -51,17 +51,17 @@ jobs:
- name: Build using cmake
env:
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_TLS:BOOL=ON
run: mkdir build && cd build && cmake .. && make

- name: Build using Makefile
run: USE_SSL=1 TEST_ASYNC=1 make
run: USE_TLS=1 TEST_ASYNC=1 make

- name: Run tests
working-directory: tests
env:
SKIPS_AS_FAILS: 1
TEST_SSL: 1
TEST_TLS: 1
run: ./test.sh

freebsd:
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
if [ -n "${{ matrix.sanitizer }}" ]; then
export CFLAGS="-fno-omit-frame-pointer -fsanitize=${{ matrix.sanitizer }}"
fi
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_SSL=ON -DENABLE_IPV6_TESTS=ON
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_TLS=ON -DENABLE_IPV6_TESTS=ON
- name: Build
working-directory: build
run: VERBOSE=1 make
Expand Down Expand Up @@ -102,18 +102,18 @@ jobs:
git clone --depth 1 --branch 7.2.5 https://github.com/valkey-io/valkey.git
cd valkey && sudo BUILD_TLS=yes make install
- name: Build
run: USE_SSL=1 TEST_ASYNC=1 make
run: USE_TLS=1 TEST_ASYNC=1 make
- name: Run tests
working-directory: tests
env:
SKIPS_AS_FAILS: 1
TEST_SSL: 1
TEST_TLS: 1
run: ./test.sh
- name: Run tests under valgrind
working-directory: tests
env:
SKIPS_AS_FAILS: 1
TEST_SSL: 1
TEST_TLS: 1
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
run: ./test.sh

Expand All @@ -129,26 +129,26 @@ jobs:
version: 1.0
- name: Install libvalkey using Makefile
run: |
make USE_SSL=1 DESTDIR=${{ github.workspace }}/make-install install
make USE_TLS=1 DESTDIR=${{ github.workspace }}/make-install install
- name: Install libvalkey using CMake
run: |
mkdir build && cd build
cmake -DDISABLE_TESTS=ON -DENABLE_SSL=ON ..
cmake -DDISABLE_TESTS=ON -DENABLE_TLS=ON ..
make DESTDIR=${{ github.workspace }}/cmake-install install
- name: Build examples with Makefile using a Makefile-installed libvalkey
run: |
make CFLAGS="-I${{ github.workspace }}/make-install/usr/local/include" \
STLIBNAME="${{ github.workspace }}/make-install/usr/local/lib/libvalkey.a" \
USE_SSL=1 -C examples
USE_TLS=1 -C examples
- name: Build examples with Makefile using a CMake-installed libvalkey
run: |
make CFLAGS="-I${{ github.workspace }}/cmake-install/usr/local/include" \
STLIBNAME="${{ github.workspace }}/cmake-install/usr/local/lib/libvalkey.a" \
USE_SSL=1 -C examples
USE_TLS=1 -C examples
- name: Build examples with CMake using a CMake-installed libvalkey
run: |
cd examples && mkdir build && cd build
cmake -DCMAKE_PREFIX_PATH=${{ github.workspace }}/cmake-install/usr/local -DENABLE_SSL=ON ..
cmake -DCMAKE_PREFIX_PATH=${{ github.workspace }}/cmake-install/usr/local -DENABLE_TLS=ON ..
make
macos:
Expand All @@ -165,14 +165,14 @@ jobs:
- name: Build using CMake
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_SSL=ON
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TLS=ON
ninja -v
- name: Build using Makefile
run: USE_SSL=1 make
run: USE_TLS=1 make
- name: Run tests
working-directory: tests
env:
TEST_SSL: 1
TEST_TLS: 1
run: ./test.sh

windows:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Prepare
run: |
mkdir build; cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SSL=ON ..
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TLS=ON ..
- name: Build, scan and report
uses: vapier/coverity-scan-action@2068473c7bdf8c2fb984a6a40ae76ee7facd7a85 # v1.8.0
with:
Expand Down
52 changes: 26 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PROJECT(valkey LANGUAGES "C" VERSION "${VERSION}")
INCLUDE(GNUInstallDirs)

OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
OPTION(ENABLE_SSL "Build valkey_ssl for SSL support" OFF)
OPTION(ENABLE_TLS "Build valkey_tls for TLS support" OFF)
OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF)
OPTION(ENABLE_EXAMPLES "Enable building valkey examples" OFF)
option(ENABLE_IPV6_TESTS "Enable IPv6 tests requiring special prerequisites" OFF)
Expand Down Expand Up @@ -152,77 +152,77 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/valkey-config.cmake
DESTINATION ${CMAKE_CONF_INSTALL_DIR})


IF(ENABLE_SSL)
IF(ENABLE_TLS)
IF (NOT OPENSSL_ROOT_DIR)
IF (APPLE)
SET(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
ENDIF()
ENDIF()
FIND_PACKAGE(OpenSSL REQUIRED)
SET(valkey_ssl_sources
src/cluster_ssl.c
src/ssl.c)
ADD_LIBRARY(valkey_ssl ${valkey_ssl_sources})
ADD_LIBRARY(valkey::valkey_ssl ALIAS valkey_ssl)
SET(valkey_tls_sources
src/cluster_tls.c
src/tls.c)
ADD_LIBRARY(valkey_tls ${valkey_tls_sources})
ADD_LIBRARY(valkey::valkey_tls ALIAS valkey_tls)

TARGET_INCLUDE_DIRECTORIES(valkey_ssl
TARGET_INCLUDE_DIRECTORIES(valkey_tls
PRIVATE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/valkey>
)

IF (APPLE AND BUILD_SHARED_LIBS)
SET_PROPERTY(TARGET valkey_ssl PROPERTY LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
SET_PROPERTY(TARGET valkey_tls PROPERTY LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
ENDIF()

SET_TARGET_PROPERTIES(valkey_ssl
SET_TARGET_PROPERTIES(valkey_tls
PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
VERSION "${LIBVALKEY_SONAME}")
IF(MSVC)
SET_TARGET_PROPERTIES(valkey_ssl
SET_TARGET_PROPERTIES(valkey_tls
PROPERTIES COMPILE_FLAGS /Z7)
ENDIF()
TARGET_LINK_LIBRARIES(valkey_ssl PRIVATE OpenSSL::SSL)
TARGET_LINK_LIBRARIES(valkey_tls PRIVATE OpenSSL::SSL)
IF(WIN32)
TARGET_LINK_LIBRARIES(valkey_ssl PRIVATE valkey)
TARGET_LINK_LIBRARIES(valkey_tls PRIVATE valkey)
ENDIF()
CONFIGURE_FILE(valkey_ssl.pc.in valkey_ssl.pc @ONLY)
CONFIGURE_FILE(valkey_tls.pc.in valkey_tls.pc @ONLY)

INSTALL(TARGETS valkey_ssl
EXPORT valkey_ssl-targets
INSTALL(TARGETS valkey_tls
EXPORT valkey_tls-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

if (MSVC AND BUILD_SHARED_LIBS)
INSTALL(FILES $<TARGET_PDB_FILE:valkey_ssl>
INSTALL(FILES $<TARGET_PDB_FILE:valkey_tls>
DESTINATION ${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS Debug RelWithDebInfo)
endif()

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/valkey_ssl.pc
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/valkey_tls.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

export(EXPORT valkey_ssl-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/valkey_ssl-targets.cmake"
export(EXPORT valkey_tls-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/valkey_tls-targets.cmake"
NAMESPACE valkey::)

if(WIN32)
SET(CMAKE_CONF_INSTALL_DIR share/valkey_ssl)
SET(CMAKE_CONF_INSTALL_DIR share/valkey_tls)
else()
SET(CMAKE_CONF_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/valkey_ssl)
SET(CMAKE_CONF_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/valkey_tls)
endif()
configure_package_config_file(valkey_ssl-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/valkey_ssl-config.cmake
configure_package_config_file(valkey_tls-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/valkey_tls-config.cmake
INSTALL_DESTINATION ${CMAKE_CONF_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR)

INSTALL(EXPORT valkey_ssl-targets
FILE valkey_ssl-targets.cmake
INSTALL(EXPORT valkey_tls-targets
FILE valkey_tls-targets.cmake
NAMESPACE valkey::
DESTINATION ${CMAKE_CONF_INSTALL_DIR})

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/valkey_ssl-config.cmake
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/valkey_tls-config.cmake
DESTINATION ${CMAKE_CONF_INSTALL_DIR})
ENDIF()

Expand Down
Loading

0 comments on commit 1c57bf6

Please sign in to comment.