Skip to content

Commit b2a4041

Browse files
Fixed build for tls v1.3 on openssl v1.0.2. Added CI check (#253)
* 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
1 parent 104ed9f commit b2a4041

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,27 @@ jobs:
101101
bash <(curl -s https://codecov.io/bash) -f memtier_benchmark-*-coverage.info || echo "Codecov did not collect coverage reports"
102102
103103
build-macos:
104+
strategy:
105+
matrix:
106+
openssl: ["1.1", "3.0"]
107+
runs-on: macos-latest
108+
steps:
109+
- uses: actions/checkout@v1
110+
- name: Install dependencies
111+
run: brew install autoconf automake libtool libevent pkg-config openssl@${{ matrix.openssl }}
112+
- name: Build
113+
run: autoreconf -ivf && PKG_CONFIG_PATH=/usr/local/opt/openssl@${{ matrix.openssl }}/lib/pkgconfig ./configure && make
114+
115+
build-macos-openssl-1-0-2:
104116
strategy:
105117
matrix:
106118
platform: [macos-latest]
107119
runs-on: ${{ matrix.platform }}
108120
steps:
109121
- uses: actions/checkout@v1
110122
- name: Install dependencies
111-
run: brew install autoconf automake libtool libevent pkg-config [email protected]
123+
run: brew install autoconf automake libtool libevent pkg-config
124+
- name: Install openssl v1.0.2
125+
run: brew install rbenv/tap/[email protected]
112126
- name: Build
113-
run: autoreconf -ivf && PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig ./configure && make
127+
run: autoreconf -ivf && PKG_CONFIG_PATH=/usr/local/opt/openssl@1.0/lib/pkgconfig ./configure && make

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ On Ubuntu/Debian distributions, simply install all prerequisites as follows:
8484
To build natively on macOS, use Homebrew to install the required dependencies:
8585

8686
```
87-
$ brew install autoconf automake libtool libevent pkg-config openssl@1.1
87+
$ brew install autoconf automake libtool libevent pkg-config openssl@3.0
8888
```
8989

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

9393
```
94-
PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig ./configure
94+
PKG_CONFIG_PATH=/usr/local/opt/openssl@3.0/lib/pkgconfig ./configure
9595
```
9696

9797
### Building and installing

memtier_benchmark.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,11 @@ int main(int argc, char *argv[])
13921392
SSL_CTX_set_options(cfg.openssl_ctx, SSL_OP_NO_TLSv1_1);
13931393
if (!(cfg.tls_protocols & REDIS_TLS_PROTO_TLSv1_2))
13941394
SSL_CTX_set_options(cfg.openssl_ctx, SSL_OP_NO_TLSv1_2);
1395+
// TLS 1.3 is only available as from version 1.1.1.
1396+
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
13951397
if (!(cfg.tls_protocols & REDIS_TLS_PROTO_TLSv1_3))
13961398
SSL_CTX_set_options(cfg.openssl_ctx, SSL_OP_NO_TLSv1_3);
1399+
#endif
13971400

13981401
if (cfg.tls_cert) {
13991402
if (!SSL_CTX_use_certificate_chain_file(cfg.openssl_ctx, cfg.tls_cert)) {

0 commit comments

Comments
 (0)