|
| 1 | +# Copyright (c) The mlkem-native project authors |
| 2 | +# Copyright (c) The mldsa-native project authors |
| 3 | +# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT |
| 4 | + |
| 5 | +name: Constant-time tests |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | +on: |
| 9 | + workflow_call: |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + check-ct-varlat: |
| 14 | + # Using the patched Valgrind from the KyberSlash paper to detect divisions |
| 15 | + # In case the patch no longer applies after an update, we may want to switch back |
| 16 | + # to stock valgrind added in https://github.com/pq-code-package/mlkem-native/pull/687 |
| 17 | + name: CT test ${{ matrix.nix-shell }} ${{ matrix.system }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + max-parallel: 10 |
| 21 | + matrix: |
| 22 | + system: [ubuntu-latest, pqcp-arm64] |
| 23 | + nix-shell: |
| 24 | + - ci_valgrind-varlat_clang14 |
| 25 | + - ci_valgrind-varlat_clang15 |
| 26 | + - ci_valgrind-varlat_clang16 |
| 27 | + - ci_valgrind-varlat_clang17 |
| 28 | + - ci_valgrind-varlat_clang18 |
| 29 | + - ci_valgrind-varlat_clang19 |
| 30 | + - ci_valgrind-varlat_clang20 |
| 31 | + - ci_valgrind-varlat_gcc48 |
| 32 | + - ci_valgrind-varlat_gcc49 |
| 33 | + - ci_valgrind-varlat_gcc7 |
| 34 | + - ci_valgrind-varlat_gcc11 |
| 35 | + - ci_valgrind-varlat_gcc12 |
| 36 | + - ci_valgrind-varlat_gcc13 |
| 37 | + - ci_valgrind-varlat_gcc14 |
| 38 | + runs-on: ${{ matrix.system }} |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 41 | + - name: Setup nix |
| 42 | + uses: ./.github/actions/setup-shell |
| 43 | + with: |
| 44 | + gh_token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + nix-shell: ${{ matrix.nix-shell }} |
| 46 | + nix-cache: true |
| 47 | + - name: Build and run test (-Oz) |
| 48 | + # -Oz got introduced in gcc12 |
| 49 | + if: ${{ matrix.nix-shell != 'ci_valgrind-varlat_gcc48' && matrix.nix-shell != 'ci_valgrind-varlat_gcc49' && matrix.nix-shell != 'ci_valgrind-varlat_gcc7' && matrix.nix-shell != 'ci_valgrind-varlat_gcc11'}} |
| 50 | + uses: ./.github/actions/ct-test |
| 51 | + with: |
| 52 | + cflags: -Oz -DMLD_CONFIG_KEYGEN_PCT |
| 53 | + valgrind_flags: --variable-latency-errors=yes |
| 54 | + - name: Build and run test (-Os) |
| 55 | + uses: ./.github/actions/ct-test |
| 56 | + with: |
| 57 | + cflags: -Os -DMLD_CONFIG_KEYGEN_PCT |
| 58 | + valgrind_flags: --variable-latency-errors=yes |
| 59 | + - name: Build and run test (-O3) |
| 60 | + uses: ./.github/actions/ct-test |
| 61 | + with: |
| 62 | + cflags: -O3 -DMLD_CONFIG_KEYGEN_PCT |
| 63 | + valgrind_flags: --variable-latency-errors=yes |
| 64 | + - name: Build and run test (-Ofast) |
| 65 | + # -Ofast got deprecated in clang19; -O3 -ffast-math should be used instead |
| 66 | + if: ${{ matrix.nix-shell != 'ci_valgrind-varlat_clang19' && matrix.nix-shell != 'ci_valgrind-varlat_clang20' }} |
| 67 | + uses: ./.github/actions/ct-test |
| 68 | + with: |
| 69 | + cflags: -Ofast -DMLD_CONFIG_KEYGEN_PCT |
| 70 | + valgrind_flags: --variable-latency-errors=yes |
| 71 | + - name: Build and run test (-O3 -ffast-math) |
| 72 | + uses: ./.github/actions/ct-test |
| 73 | + with: |
| 74 | + cflags: -O3 -ffast-math -DMLD_CONFIG_KEYGEN_PCT |
| 75 | + valgrind_flags: --variable-latency-errors=yes |
| 76 | + - name: Build and run test (-O2) |
| 77 | + uses: ./.github/actions/ct-test |
| 78 | + with: |
| 79 | + cflags: -O2 -DMLD_CONFIG_KEYGEN_PCT |
| 80 | + valgrind_flags: --variable-latency-errors=yes |
| 81 | + - name: Build and run test (-O1) |
| 82 | + uses: ./.github/actions/ct-test |
| 83 | + with: |
| 84 | + cflags: -O1 -DMLD_CONFIG_KEYGEN_PCT |
| 85 | + valgrind_flags: --variable-latency-errors=yes |
| 86 | + - name: Build and run test (-O0) |
| 87 | + uses: ./.github/actions/ct-test |
| 88 | + with: |
| 89 | + cflags: -O0 -DMLD_CONFIG_KEYGEN_PCT |
| 90 | + valgrind_flags: --variable-latency-errors=yes |
0 commit comments