liboqs/scripts/noregress.sh
Marc Stevens 90030a4ae4
Add benchmarking for stateful hash based schemes: speed_sig_stfl (#1952)
* Add speed_sig_stfl

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* Fix speed_sig_stfl.c: limit timing with max sig ops & provide required secure keystore with dummy keystore

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* Cleanup speed_sig_stfl.c

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* speed_sig_stfl: fix for LMS (secure store context must not be NULL), refresh key when out of sigs for sig benchmark

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* tests/speed_sig_stfl.c: astyle fix

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* tests/speed_sig_stfl.c: stfl sig benchmarks require intermittent resetting of secret key

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* speed_sig_stfl: add speed_sig_stfl to: README scripts/nogress.sh tests/test_speed.py

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* test_speed.py: limit testing of stfl sigs to parameters with 2^10 max sigs

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* scripts/nogress.sh: limit regression tests on stfl sigs to only algorithms with 2^10 max sigs

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* speed_sig_stfl.c: astyle fix

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

* speed_sig_stfl: 1) fix use-after-free bug. 2) Simply return success if keygen and sign are not enabled.

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>

---------

Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
2024-10-22 09:16:56 -04:00

75 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: MIT
if [ $# -lt 1 ]; then
echo "Usage: $0 <liboqs-release to test regression against> [<cmake opts> [<make cmd>]]. Exiting."
exit -1
fi
if [ $# -lt 3 ]; then
MAKECMD="make -j 2"
else
MAKECMD=$3
fi
# Approach: Check out $1 into tmp folder, build, run speed_kem|sig and compare results
mkdir tmp && \
cd tmp && \
git clone --depth 1 --branch $1 https://github.com/open-quantum-safe/liboqs && \
cd liboqs && \
mkdir build && \
cd build && \
cmake $2 .. && \
$MAKECMD && \
./tests/speed_kem > ../../speed_kem.log && \
./tests/speed_sig > ../../speed_sig.log && \
./tests/speed_sig_stfl --limit10 > ../../speed_sig_stfl.log && \
cd ../../..
if [ $? -ne 0 ]; then
echo "Build and test of baseline $1 failed. Exiting."
exit -1
fi
# transform results into JSON files for simple comparison
cd tmp && \
git clone --depth 1 https://github.com/open-quantum-safe/profiling.git && \
cd profiling/perf/scripts && \
python3 parse_liboqs_speed.py ../../../speed_kem.log && \
python3 parse_liboqs_speed.py ../../../speed_sig.log && \
python3 parse_liboqs_speed.py ../../../speed_sig_stfl.log && \
cd ../../../..
if [ $? -ne 0 ]; then
echo "Failure converting results. Exiting."
exit -1
fi
# obtain current base speed results
rm -rf build && \
mkdir build && \
cd build && \
cmake $2 .. && \
$MAKECMD && \
./tests/speed_kem > speed_kem.log && \
./tests/speed_sig > speed_sig.log && \
./tests/speed_sig_stfl --limit10 > speed_sig_stfl.log && \
cd ../tmp/profiling/perf/scripts && \
python3 parse_liboqs_speed.py ../../../../build/speed_kem.log && \
python3 parse_liboqs_speed.py ../../../../build/speed_sig.log && \
python3 parse_liboqs_speed.py ../../../../build/speed_sig_stfl.log && \
cd ../../../..
if [ $? -ne 0 ]; then
echo "Failure creating current results. Exiting."
exit -1
fi
# now compare results using old/tmp runs as baseline (for list of algorithms)
python3 scripts/noregress.py tmp/speed_kem.json build/speed_kem.json && \
python3 scripts/noregress.py tmp/speed_sig.json build/speed_sig.json && \
python3 scripts/noregress.py tmp/speed_sig_stfl.json build/speed_sig_stfl.json