Skip to content

Commit a9ebb37

Browse files
committed
Let perftools to also bench OpenSSL forks.
This change adjusts existing perftools so they cne be built by 3rd party SSL libraries (a.k.a. OpenSSL forks). Currently those tools can be used to bench OpenSSL forks: randbytes, rsasign, handshake, sslnew, x509storeissuer. evp_setpeer, writeread The change also adds bench_config_forks.sh which installs forks and builds perftools. And bench_run_forks.sh which runs tests and plots results. Fixes openssl/project#1845
1 parent e001ad7 commit a9ebb37

14 files changed

Lines changed: 667 additions & 102 deletions

bench-scripts/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ all siege tests connect to HA-proxy via, which then establishes SSL connection
8484
towards httpterm [10] server. To collect performance data The siege client
8585
executes requests which fetch 1k of data from httpterm server.
8686

87+
## OpenSSL Forks
88+
89+
This test builds OpenSSL forks and uses perftools to benchmark those forks.
90+
The list of perftools which can run with forks:
91+
randbytes
92+
rsasign
93+
handshake
94+
sslnew
95+
x509storeissuer
96+
evp_setpeer (only for some keys)
97+
98+
The bench_config_forks.sh script builds and install libraries. It also builds
99+
perftools for each OpenSSL fork library. The script also builds openssl-master.
100+
The bench_run_forks.sh runs tests and plots results as .png files.
101+
87102
## Build requirements
88103

89104
Requirements for ubuntu are the following:
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env ksh
2+
#
3+
# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License 2.0 (the "License"). You may not use
6+
# this file except in compliance with the License. You can obtain a copy
7+
# in the file LICENSE in the source distribution or at
8+
# https://www.openssl.org/source/license.html
9+
#
10+
11+
set -x
12+
13+
. ./common_util.sh
14+
15+
INSTALL_ROOT=${BENCH_INSTALL_ROOT:-"/tmp/bench.binaries"}
16+
RESULT_DIR=${BENCH_RESULTS:-"${INSTALL_ROOT}/results"}
17+
WORKSPACE_ROOT=${BENCH_WORKSPACE_ROOT:-"/tmp/bench.workspace"}
18+
MAKE_OPTS=${BENCH_MAKE_OPTS}
19+
CFLAGS_SAVE=${CFLAGS}
20+
21+
WOLFSSL_VERSION=5.8.2
22+
LIBRESSL_VERSION=4.2.1
23+
OPENSSL_VERSION=master
24+
25+
function build_perftools {
26+
#
27+
# when testing changes for C-code or CMakeFileList.txt
28+
# you must change link to repository, so script pulls
29+
# modified sources
30+
#
31+
typeset PERFTOOLS='https://github.com/openssl/perftools'
32+
33+
cd ${WORKSPACE_ROOT} || exit 1
34+
#
35+
# you may also need to change clone command to
36+
# checkout correct branch.
37+
#
38+
git clone ${PERFTOOLS} || exit 1
39+
cd perftools/source || exit 1
40+
41+
cmake -S ${WORKSPACE_ROOT}/perftools/source \
42+
-B ${INSTALL_ROOT}/build.openssl-${OPENSSL_VERSION} \
43+
-DOPENSSL_CONFIG_MODE=1 \
44+
-DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/openssl-${OPENSSL_VERSION} \
45+
-DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/openssl-${OPENSSL_VERSION} || exit 1
46+
cmake --build ${INSTALL_ROOT}/build.openssl-${OPENSSL_VERSION} || exit 1
47+
48+
cmake -S ${WORKSPACE_ROOT}/perftools/source \
49+
-B ${INSTALL_ROOT}/build.wolfssl-${WOLFSSL_VERSION} \
50+
-DWITH_OPENSSL_FORK=1 \
51+
-DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/wolfssl-${WOLFSSL_VERSION} || exit 1
52+
cmake --build ${INSTALL_ROOT}/build.wolfssl-${WOLFSSL_VERSION} || exit 1
53+
54+
cmake -S ${WORKSPACE_ROOT}/perftools/source \
55+
-B ${INSTALL_ROOT}/build.libressl-${LIBRESSL_VERSION} \
56+
-DWITH_OPENSSL_FORK=1 \
57+
-DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/libressl-${LIBRESSL_VERSION} || exit 1
58+
cmake --build ${INSTALL_ROOT}/build.libressl-${LIBRESSL_VERSION} || exit 1
59+
60+
cmake -S . -B $BENCH_INSTALL_ROOT/build.boringssl/ \
61+
-DCMAKE_PREFIX_PATH=$BENCH_INSTALL_ROOT/boringssl \
62+
-DWITH_OPENSSL_FORK=1 || exit 1
63+
cmake --build ${INSTALL_ROOT}/build.boringssl || exit 1
64+
65+
cmake -S . -B $BENCH_INSTALL_ROOT/build.aws-lc/ \
66+
-DCMAKE_PREFIX_PATH=$BENCH_INSTALL_ROOT/aws-lc \
67+
-DWITH_OPENSSL_FORK=1 || exit 1
68+
cmake --build ${INSTALL_ROOT}/build.aws-lc || exit 1
69+
}
70+
71+
install_openssl ${OPENSSL_VERSION}
72+
73+
#
74+
# enable WolfSSL's compatibility layer with OpenSSL.
75+
# another option is to use ./configure --enable-opensslextra
76+
# see: https://www.wolfssl.com/documentation/manuals/wolfssl/chapter13.html
77+
#
78+
CFLAGS="${CFLAGS} -DOPENSSL_EXTRA -DOPENSSL_ALL"
79+
install_wolfssl ${WOLFSSL_VERSION}
80+
CFLAGS=${CFLAGS_SAVE}
81+
82+
install_libressl ${LIBRESSL_VERSION}
83+
84+
install_boringssl
85+
86+
install_aws_lc
87+
88+
build_perftools

0 commit comments

Comments
 (0)