From a8bcdcb3c699f9480da2b76d8e572269dc172eea Mon Sep 17 00:00:00 2001 From: Andrew Hopkins Date: Wed, 13 Mar 2024 14:59:01 -0700 Subject: [PATCH] Only enable dilithium if AWS-LC API supports it. --- tests/ci/run_benchmark_build_tests.sh | 22 +++++++++++++--------- tool/speed.cc | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/ci/run_benchmark_build_tests.sh b/tests/ci/run_benchmark_build_tests.sh index 6831a3e855..c16de12d7e 100755 --- a/tests/ci/run_benchmark_build_tests.sh +++ b/tests/ci/run_benchmark_build_tests.sh @@ -29,19 +29,20 @@ function build_aws_lc_fips { popd } -function build_aws_lc_fips_2022 { - echo "building the fips-2022-11-02 branch of aws-lc in FIPS mode" - git clone --depth 1 --branch fips-2022-11-02 https://github.com/aws/aws-lc.git "${scratch_folder}/aws-lc-fips-2022-11-02" - pushd "${scratch_folder}/aws-lc-fips-2022-11-02" +function build_aws_lc_branch { + branch="$1" + echo "building the ${branch} branch of aws-lc in FIPS mode" + git clone --depth 1 --branch $branch https://github.com/aws/aws-lc.git "${scratch_folder}/aws-lc-${branch}" + pushd "${scratch_folder}/aws-lc-${branch}" cmake -GNinja \ - -DCMAKE_INSTALL_PREFIX="${install_dir}/aws-lc-fips-2022-11-02" \ + -DCMAKE_INSTALL_PREFIX="${install_dir}/aws-lc-${branch}" \ -DFIPS=1 \ -DENABLE_DILITHIUM=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_TESTING=OFF ninja install popd - rm -rf "${scratch_folder}/aws-lc-fips-2022-11-02" + rm -rf "${scratch_folder}/aws-lc-${branch}" } function build_openssl { @@ -77,7 +78,8 @@ function build_boringssl { build_aws_lc_fips "${BUILD_ROOT}/tool/bssl" speed -timeout_ms 10 -build_aws_lc_fips_2022 +build_aws_lc_branch fips-2022-11-02 +build_aws_lc_branch fips-2021-10-20 build_openssl $openssl_1_0_2_branch build_openssl $openssl_1_1_1_branch build_openssl $openssl_3_1_branch @@ -86,14 +88,16 @@ build_openssl $openssl_master_branch build_boringssl run_build -DASAN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_STANDARD=14 -DCMAKE_C_STANDARD=11 -DBENCHMARK_LIBS="\ -aws-lc-fips:${install_dir}/aws-lc-fips-2022-11-02;\ +aws-lc-fips-2021:${install_dir}/aws-lc-fips-2021-10-20;\ +aws-lc-fips-2022:${install_dir}/aws-lc-fips-2022-11-02;\ open102:${install_dir}/openssl-${openssl_1_0_2_branch};\ open111:${install_dir}/openssl-${openssl_1_1_1_branch};\ open31:${install_dir}/openssl-${openssl_3_1_branch};\ open32:${install_dir}/openssl-${openssl_3_2_branch};\ openmaster:${install_dir}/openssl-${openssl_master_branch};\ boringssl:${install_dir}/boringssl;" -"${BUILD_ROOT}/tool/aws-lc-fips" -timeout_ms 10 +"${BUILD_ROOT}/tool/aws-lc-fips-2021" -timeout_ms 10 +"${BUILD_ROOT}/tool/aws-lc-fips-2022" -timeout_ms 10 "${BUILD_ROOT}/tool/open102" -timeout_ms 10 "${BUILD_ROOT}/tool/open111" -timeout_ms 10 "${BUILD_ROOT}/tool/open31" -timeout_ms 10 diff --git a/tool/speed.cc b/tool/speed.cc index c352ba64d4..2a61eda680 100644 --- a/tool/speed.cc +++ b/tool/speed.cc @@ -842,7 +842,7 @@ static bool SpeedKEM(std::string selected) { SpeedSingleKEM("Kyber1024_R3", NID_KYBER1024_R3, selected); } -#if defined(ENABLE_DILITHIUM) +#if defined(ENABLE_DILITHIUM) && AWSLC_API_VERSION > 20 static bool SpeedDigestSignNID(const std::string &name, int nid, const std::string &selected) {