Skip to content

Commit

Permalink
Fixed build for tls v1.3 on openssl v1.0.2. Added CI check (#253)
Browse files Browse the repository at this point in the history
* fixed build for tls v1.3 on openssl v1.0.2. Added CI check

* fixed ci step name

* Include test for openssl v3.0

* Make reference to [email protected] on the Readme given its the LTS version
  • Loading branch information
filipecosta90 authored Apr 8, 2024
1 parent 104ed9f commit b2a4041
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,27 @@ jobs:
bash <(curl -s https://codecov.io/bash) -f memtier_benchmark-*-coverage.info || echo "Codecov did not collect coverage reports"
build-macos:
strategy:
matrix:
openssl: ["1.1", "3.0"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: brew install autoconf automake libtool libevent pkg-config openssl@${{ matrix.openssl }}
- name: Build
run: autoreconf -ivf && PKG_CONFIG_PATH=/usr/local/opt/openssl@${{ matrix.openssl }}/lib/pkgconfig ./configure && make

build-macos-openssl-1-0-2:
strategy:
matrix:
platform: [macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: brew install autoconf automake libtool libevent pkg-config [email protected]
run: brew install autoconf automake libtool libevent pkg-config
- name: Install openssl v1.0.2
run: brew install rbenv/tap/[email protected]
- name: Build
run: autoreconf -ivf && PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig ./configure && make
run: autoreconf -ivf && PKG_CONFIG_PATH=/usr/local/opt/openssl@1.0/lib/pkgconfig ./configure && make
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ On Ubuntu/Debian distributions, simply install all prerequisites as follows:
To build natively on macOS, use Homebrew to install the required dependencies:

```
$ brew install autoconf automake libtool libevent pkg-config openssl@1.1
$ brew install autoconf automake libtool libevent pkg-config openssl@3.0
```

When running `./configure`, if it fails to find libssl it may be necessary to
tweak the `PKG_CONFIG_PATH` environment variable:

```
PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig ./configure
PKG_CONFIG_PATH=/usr/local/opt/openssl@3.0/lib/pkgconfig ./configure
```

### Building and installing
Expand Down
3 changes: 3 additions & 0 deletions memtier_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,8 +1392,11 @@ int main(int argc, char *argv[])
SSL_CTX_set_options(cfg.openssl_ctx, SSL_OP_NO_TLSv1_1);
if (!(cfg.tls_protocols & REDIS_TLS_PROTO_TLSv1_2))
SSL_CTX_set_options(cfg.openssl_ctx, SSL_OP_NO_TLSv1_2);
// TLS 1.3 is only available as from version 1.1.1.
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
if (!(cfg.tls_protocols & REDIS_TLS_PROTO_TLSv1_3))
SSL_CTX_set_options(cfg.openssl_ctx, SSL_OP_NO_TLSv1_3);
#endif

if (cfg.tls_cert) {
if (!SSL_CTX_use_certificate_chain_file(cfg.openssl_ctx, cfg.tls_cert)) {
Expand Down

0 comments on commit b2a4041

Please sign in to comment.