Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded build paths & modify basic workflow to build in random path #2019

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 29 additions & 22 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,27 @@ jobs:
KEM_NAME: ml_kem_768
SIG_NAME: ml_dsa_65
steps:
- name: Create random build folder
run: tmp_build=$(mktemp -d) && echo "RANDOM_BUILD_DIR=$tmp_build" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Configure
run: |
mkdir build && \
cd build && \
cmake -GNinja -DOQS_STRICT_WARNINGS=ON \
cmake \
-B ${{ env.RANDOM_BUILD_DIR }} \
-GNinja \
-DOQS_STRICT_WARNINGS=ON \
-DOQS_MINIMAL_BUILD="KEM_$KEM_NAME;SIG_$SIG_NAME" \
--warn-uninitialized .. > config.log 2>&1 && \
--warn-uninitialized . > config.log 2>&1 && \
cat config.log && \
cmake -LA -N .. && \
cmake -LA -N . && \
! (grep -i "uninitialized variable" config.log)
- name: Build code
run: ninja
working-directory: build
working-directory: ${{ env.RANDOM_BUILD_DIR }}
- name: Build documentation
run: ninja gen_docs
working-directory: build
working-directory: ${{ env.RANDOM_BUILD_DIR }}

cppcheck:
name: Check C++ linking with example program
Expand All @@ -94,28 +96,30 @@ jobs:
env:
SIG_NAME: dilithium_2
steps:
- name: Create random build folder
run: tmp_build=$(mktemp -d) && echo "RANDOM_BUILD_DIR=$tmp_build" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Configure
run: |
mkdir build && \
cd build && \
cmake -GNinja -DOQS_STRICT_WARNINGS=ON \
cmake \
-B ${{ env.RANDOM_BUILD_DIR }} \
-GNinja \
-DOQS_STRICT_WARNINGS=ON \
-DOQS_MINIMAL_BUILD="SIG_$SIG_NAME" \
--warn-uninitialized .. > config.log 2>&1 && \
--warn-uninitialized . > config.log 2>&1 && \
cat config.log && \
cmake -LA -N .. && \
cmake -LA -N . && \
! (grep -i "uninitialized variable" config.log)
- name: Build liboqs
run: ninja
working-directory: build
working-directory: ${{ env.RANDOM_BUILD_DIR }}
- name: Link with C++ program
run: |
g++ ../cpp/sig_linking_test.cpp -g \
g++ "$GITHUB_WORKSPACE"/cpp/sig_linking_test.cpp -g \
-I./include -L./lib -loqs -lcrypto -std=c++11 -o example_sig && \
./example_sig
working-directory: build
working-directory: ${{ env.RANDOM_BUILD_DIR }}

fuzzbuildcheck:
name: Check that code passes a basic fuzzing build
Expand All @@ -129,23 +133,26 @@ jobs:
CFLAGS: -fsanitize=fuzzer-no-link,address
LDFLAGS: -fsanitize=address
steps:
- name: Create random build folder
run: tmp_build=$(mktemp -d) && echo "RANDOM_BUILD_DIR=$tmp_build" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Configure
run: |
mkdir build && \
cd build && \
cmake -GNinja -DOQS_STRICT_WARNINGS=ON \
cmake \
-B ${{ env.RANDOM_BUILD_DIR }} \
-GNinja \
-DOQS_STRICT_WARNINGS=ON \
-DOQS_BUILD_FUZZ_TESTS=ON \
-DOQS_MINIMAL_BUILD="SIG_$SIG_NAME" \
--warn-uninitialized .. > config.log 2>&1 && \
--warn-uninitialized . > config.log 2>&1 && \
cat config.log && \
cmake -LA -N .. && \
cmake -LA -N . && \
! (grep -i "uninitialized variable" config.log)
- name: Build code
run: ninja fuzz_test_sig
working-directory: build
working-directory: ${{ env.RANDOM_BUILD_DIR }}

- name: Short fuzz check (30s)
run: ./tests/fuzz_test_sig -max_total_time=30
working-directory: build
working-directory: ${{ env.RANDOM_BUILD_DIR }}
15 changes: 10 additions & 5 deletions tests/test_acvp_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ def test_acvp_vec_sig_keygen(sig_name):
seed = testCase["seed"]
pk = testCase["pk"]
sk = testCase["sk"]


build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_sig', sig_name, "keyGen", seed, pk, sk]
[f'{build_dir}/tests/vectors_sig', sig_name, "keyGen", seed, pk, sk]
)

assert(variantFound == True)
Expand All @@ -146,8 +147,10 @@ def test_acvp_vec_sig_gen_deterministic(sig_name):
sk = testCase["sk"]
message = testCase["message"]
signature = testCase["signature"]

build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_sig', sig_name, "sigGen_det", sk, message, signature]
[f'{build_dir}/tests/vectors_sig', sig_name, "sigGen_det", sk, message, signature]
)

assert(variantFound == True)
Expand All @@ -173,8 +176,9 @@ def test_acvp_vec_sig_gen_randomized(sig_name):
signature = testCase["signature"]
rnd = testCase["rnd"]

build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_sig', sig_name, "sigGen_rnd", sk, message, signature, rnd]
[f'{build_dir}/tests/vectors_sig', sig_name, "sigGen_rnd", sk, message, signature, rnd]
)

assert(variantFound == True)
Expand All @@ -200,8 +204,9 @@ def test_acvp_vec_sig_ver(sig_name):
signature = testCase["signature"]
testPassed = "1" if testCase["testPassed"] else "0"

build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_sig', sig_name, "sigVer", pk, message, signature, testPassed]
[f'{build_dir}/tests/vectors_sig', sig_name, "sigVer", pk, message, signature, testPassed]
)

assert(variantFound == True)
Expand Down
Loading