mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-03 00:02:36 -04:00
* copy from slhdsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * integrate with copy from upstream Signed-off-by: h2parson <h2parson@uwaterloo.ca> * explicitly list slhdsa files to include and push generated code Signed-off-by: h2parson <h2parson@uwaterloo.ca> * format code script Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add to requirements.in Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix code conventions Signed-off-by: h2parson <h2parson@uwaterloo.ca> * copy from upstream changes Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add chdir to copy from slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * modify template Signed-off-by: h2parson <h2parson@uwaterloo.ca> * generate requirements.txt Signed-off-by: h2parson <h2parson@uwaterloo.ca> * modify requirments in workflows Signed-off-by: h2parson <h2parson@uwaterloo.ca> * format Signed-off-by: h2parson <h2parson@uwaterloo.ca> * a Signed-off-by: h2parson <h2parson@uwaterloo.ca> * sort filenames in cmake file generation for slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add newline at end of header file Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add whitespace and fix alg info tests Signed-off-by: h2parson <h2parson@uwaterloo.ca> * update docs with copy from upstream Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add whitespace to src files Signed-off-by: h2parson <h2parson@uwaterloo.ca> * initialize ctx in slh Signed-off-by: h2parson <h2parson@uwaterloo.ca> * explicitly set little endian for windows x86 Signed-off-by: h2parson <h2parson@uwaterloo.ca> * temporarily disable ctx signing for slh tests Signed-off-by: h2parson <h2parson@uwaterloo.ca> * disable kats until hashes available for slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix issues in test sig mem Signed-off-by: h2parson <h2parson@uwaterloo.ca> * temporarily add namespaces so that slh dsa will not break test namespace Signed-off-by: h2parson <h2parson@uwaterloo.ca> * updates Signed-off-by: h2parson <h2parson@uwaterloo.ca> * formatted file Signed-off-by: h2parson <h2parson@uwaterloo.ca> * align jinja template to astyle Signed-off-by: h2parson <h2parson@uwaterloo.ca> * change addrnd size Signed-off-by: h2parson <h2parson@uwaterloo.ca> * copy from slhdsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * integrate with copy from upstream Signed-off-by: h2parson <h2parson@uwaterloo.ca> * explicitly list slhdsa files to include and push generated code Signed-off-by: h2parson <h2parson@uwaterloo.ca> * format code script Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add to requirements.in Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix code conventions Signed-off-by: h2parson <h2parson@uwaterloo.ca> * copy from upstream changes Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add chdir to copy from slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * modify template Signed-off-by: h2parson <h2parson@uwaterloo.ca> * generate requirements.txt Signed-off-by: h2parson <h2parson@uwaterloo.ca> * modify requirments in workflows Signed-off-by: h2parson <h2parson@uwaterloo.ca> * format Signed-off-by: h2parson <h2parson@uwaterloo.ca> * a Signed-off-by: h2parson <h2parson@uwaterloo.ca> * sort filenames in cmake file generation for slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add newline at end of header file Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add whitespace and fix alg info tests Signed-off-by: h2parson <h2parson@uwaterloo.ca> * update docs with copy from upstream Signed-off-by: h2parson <h2parson@uwaterloo.ca> * add whitespace to src files Signed-off-by: h2parson <h2parson@uwaterloo.ca> * initialize ctx in slh Signed-off-by: h2parson <h2parson@uwaterloo.ca> * explicitly set little endian for windows x86 Signed-off-by: h2parson <h2parson@uwaterloo.ca> * temporarily disable ctx signing for slh tests Signed-off-by: h2parson <h2parson@uwaterloo.ca> * disable kats until hashes available for slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix issues in test sig mem Signed-off-by: h2parson <h2parson@uwaterloo.ca> * temporarily add namespaces so that slh dsa will not break test namespace Signed-off-by: h2parson <h2parson@uwaterloo.ca> * updates Signed-off-by: h2parson <h2parson@uwaterloo.ca> * formatted file Signed-off-by: h2parson <h2parson@uwaterloo.ca> * align jinja template to astyle Signed-off-by: h2parson <h2parson@uwaterloo.ca> * change addrnd size Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix std algs filtering issue Signed-off-by: h2parson <h2parson@uwaterloo.ca> * modifying windows amd toolchain file to fix endianness issue Signed-off-by: h2parson <h2parson@uwaterloo.ca> * disable leak testing on slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * disable slh dsa for arm emulated linux and zephyr tests Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix zephyr test skip logic Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix upstream issue with prehash naming and add variant specific nist levels Signed-off-by: h2parson <h2parson@uwaterloo.ca> * automatically update slh dsa yml file Signed-off-by: h2parson <h2parson@uwaterloo.ca> * get slh dsa md file generation working Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix naming in slh wrapper files Signed-off-by: h2parson <h2parson@uwaterloo.ca> * minor changes from review Signed-off-by: h2parson <h2parson@uwaterloo.ca> * separate slh dsa jobs from stfl sigs Signed-off-by: h2parson <h2parson@uwaterloo.ca> * separate slhdsa from sig stfl tests on mac and windows Signed-off-by: h2parson <h2parson@uwaterloo.ca> * fix macos yml format Signed-off-by: h2parson <h2parson@uwaterloo.ca> * modify zephyr timeout Signed-off-by: h2parson <h2parson@uwaterloo.ca> * re-enable some tests for slh dsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> * separate leak tests Signed-off-by: h2parson <h2parson@uwaterloo.ca> * allow algorithm family level enablement and reconfigure slhdsa CI jobs Signed-off-by: h2parson <h2parson@uwaterloo.ca> * move slh dsa address sanitizer to extended tests and extend time limit to 90 minutes Signed-off-by: h2parson <h2parson@uwaterloo.ca> * remove package deb from CI job, remove auto gen kat sig for slhdsa, add prime ctx step for sig testing slhdsa Signed-off-by: h2parson <h2parson@uwaterloo.ca> --------- Signed-off-by: h2parson <h2parson@uwaterloo.ca>
59 lines
3.1 KiB
Python
59 lines
3.1 KiB
Python
# SPDX-License-Identifier: MIT
|
|
|
|
import helpers
|
|
import os
|
|
import pytest
|
|
import re
|
|
import sys
|
|
|
|
@helpers.filtered_test
|
|
@pytest.mark.parametrize('kem_name', helpers.available_kems_by_name())
|
|
def test_kem_leak(kem_name):
|
|
if not(helpers.is_kem_enabled_by_name(kem_name)): pytest.skip('Not enabled')
|
|
if sys.platform != "linux" or os.system("grep ubuntu /etc/os-release") != 0 or os.system("uname -a | grep x86_64") != 0: pytest.skip('Leak testing not supported on this platform')
|
|
helpers.run_subprocess(
|
|
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", "--vex-guest-max-insns=25", "--track-origins=yes", helpers.path_to_executable('test_kem'), kem_name],
|
|
)
|
|
|
|
@helpers.filtered_test
|
|
@pytest.mark.parametrize('sig_name', helpers.available_sigs_by_name())
|
|
def test_sig_leak(sig_name):
|
|
if ("SLH_DSA" in sig_name): pytest.skip()
|
|
if not(helpers.is_sig_enabled_by_name(sig_name)): pytest.skip('Not enabled')
|
|
if sys.platform != "linux" or os.system("grep ubuntu /etc/os-release") != 0 or os.system("uname -a | grep x86_64") != 0: pytest.skip('Leak testing not supported on this platform')
|
|
helpers.run_subprocess(
|
|
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", helpers.path_to_executable('test_sig'), sig_name],
|
|
)
|
|
|
|
@pytest.mark.skipif("SLH_DSA_LEAK_TEST" not in os.environ, reason="SLH DSA leak testing only performed in extended tests")
|
|
@helpers.filtered_test
|
|
@pytest.mark.parametrize('sig_name', helpers.available_sigs_by_name())
|
|
def test_slhdsa_leak(sig_name):
|
|
if (not ("SLH_DSA" in sig_name)): pytest.skip()
|
|
if not(helpers.is_sig_enabled_by_name(sig_name)): pytest.skip('Not enabled')
|
|
if sys.platform != "linux" or os.system("grep ubuntu /etc/os-release") != 0 or os.system("uname -a | grep x86_64") != 0: pytest.skip('Leak testing not supported on this platform')
|
|
helpers.run_subprocess(
|
|
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", helpers.path_to_executable('test_sig'), sig_name],
|
|
)
|
|
|
|
@helpers.filtered_test
|
|
@pytest.mark.parametrize('sig_stfl_name', helpers.available_sig_stfls_by_name())
|
|
def test_sig_stfl_leak(sig_stfl_name):
|
|
if not(helpers.is_sig_stfl_enabled_by_name(sig_stfl_name)): pytest.skip('Not enabled')
|
|
if sys.platform != "linux" or os.system("grep ubuntu /etc/os-release") != 0 or os.system("uname -a | grep x86_64") != 0: pytest.skip('Leak testing not supported on this platform')
|
|
if sig_stfl_name.startswith("XMSS"):
|
|
katfile = helpers.get_katfile("sig_stfl", sig_stfl_name)
|
|
if not katfile: pytest.skip("KATs file is missing")
|
|
helpers.run_subprocess(
|
|
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", helpers.path_to_executable('test_sig_stfl'), sig_stfl_name, katfile],
|
|
)
|
|
else:
|
|
helpers.run_subprocess(
|
|
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", helpers.path_to_executable('test_sig_stfl'), sig_stfl_name],
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
import sys
|
|
pytest.main(sys.argv)
|
|
|