Skip to content

Commit

Permalink
Only enable dilithium if AWS-LC API supports it.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhop committed Mar 13, 2024
1 parent 6d9a767 commit a8bcdcb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions tests/ci/run_benchmark_build_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tool/speed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a8bcdcb

Please sign in to comment.