Skip to content

Commit a6e16d6

Browse files
committed
Add basic AWS-LC integration test
This commit extends the CI with an integration test for AWS-LC. The integration test currently works with the `mlkem_native` branch from the fork `hanno-becker/aws-lc`, which - Removes the reference implementation - Provides an importer.sh for importing mlkem-native - Provides the glue code between mlkem-native's own API and the API expected by AWS-LC. - As a temporary change, it disables `-Werror=redundant-decls`, because mlkem-native does not yet support it. The CI checks that mlkem-native successfully integrated to this fork, by building and running basic tests of AWS-LC in FIPS and non-FIPS mode. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
1 parent ae30f83 commit a6e16d6

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: Setup AWS-LC
4+
description: Setup AWS-LC
5+
6+
inputs:
7+
dir:
8+
description: Directory to fetch AWS-LC into
9+
default: 'AWS-LC'
10+
repository:
11+
description: Repository to fetch from
12+
default: 'aws/AWS-LC'
13+
commit:
14+
description: Commit to fetch
15+
default: 'HEAD'
16+
gh_token:
17+
description: Github access token to use
18+
required: true
19+
20+
runs:
21+
using: composite
22+
steps:
23+
- name: Fetch AWS-LC
24+
shell: bash
25+
run: |
26+
mkdir ${{ inputs.dir }} && cd ${{ inputs.dir }}
27+
git config --global --add safe.directory $GITHUB_WORKSPACE/${{ inputs.dir }}
28+
git init
29+
git remote add origin $GITHUB_SERVER_URL/${{ inputs.repository }}
30+
git fetch origin --depth 1 ${{ inputs.commit }}
31+
git checkout FETCH_HEAD
32+
33+
# Remember AWS-LC directory
34+
echo AWSLC_DIR="$GITHUB_WORKSPACE/${{ inputs.dir }}" >> $GITHUB_ENV
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: Dependencies (apt)
4+
description: Install dependencies via brew
5+
6+
inputs:
7+
packages:
8+
description: Space-separated list of additional packages to install
9+
required: false
10+
default: ''
11+
sudo:
12+
required: false
13+
default: 'sudo'
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Update package repository
19+
shell: bash
20+
run: |
21+
brew update
22+
- name: Install base packages
23+
shell: bash
24+
run: |
25+
brew install make gcc python3
26+
- name: Install additional packages
27+
if: ${{ inputs.packages != ''}}
28+
shell: bash
29+
run: |
30+
brew install ${{ inputs.packages }}

.github/actions/setup-os/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ runs:
2020
run: |
2121
if (which yum > /dev/null); then
2222
echo PKG="yum" >> $GITHUB_ENV
23+
elif (which brew > /dev/null); then
24+
echo PKG="brew" >> $GITHUB_ENV
2325
elif (which apt > /dev/null); then
2426
echo PKG="apt" >> $GITHUB_ENV
2527
fi
@@ -35,3 +37,9 @@ runs:
3537
with:
3638
packages: ${{ inputs.packages }}
3739
sudo: ${{ inputs.sudo }}
40+
- name: Setup via brew
41+
if: ${{ env.PKG == 'brew' }}
42+
uses: ./.github/actions/setup-brew
43+
with:
44+
packages: ${{ inputs.packages }}
45+
sudo: ${{ inputs.sudo }}

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,61 @@ jobs:
209209
./scripts/autogen ${{ matrix.backend.arg }} ${{ matrix.simplify.arg }}
210210
make clean
211211
OPT=1 make quickcheck
212+
aws_lc_integration_fips:
213+
strategy:
214+
fail-fast: false
215+
matrix:
216+
system: [ubuntu-latest, pqcp-arm64]
217+
fips: [0,1]
218+
name: AWS-LC FIPS test (${{ matrix.system }}, FIPS=${{ matrix.fips }})
219+
runs-on: ${{ matrix.system }}
220+
steps:
221+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
222+
- uses: ./.github/actions/setup-os
223+
with:
224+
packages: 'cmake'
225+
- uses: ./.github/actions/setup-aws-lc
226+
with:
227+
repository: 'hanno-becker/aws-lc'
228+
commit: 'mlkem_native'
229+
- name: Run importer
230+
run: |
231+
cd $AWSLC_DIR/crypto/fipsmodule/ml_kem
232+
GITHUB_REPOSITORY=$GITHUB_REPOSITORY GITHUB_SHA=$GITHUB_SHA ./importer.sh
233+
- name: Build AWS-LC (FIPS=1)
234+
run: |
235+
cd $AWSLC_DIR
236+
mkdir build
237+
cd build
238+
cmake -DFIPS=${{ matrix.fips }} ..
239+
cd ..
240+
241+
cmake --build ./build --target all
242+
cmake --build ./build --target run_tests
243+
aws_lc_integration_posix:
244+
strategy:
245+
fail-fast: false
246+
matrix:
247+
system: [ubuntu-latest, pqcp-arm64, macos-latest]
248+
name: AWS-LC Posix test (${{ matrix.system }})
249+
runs-on: ${{ matrix.system }}
250+
steps:
251+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
252+
- uses: ./.github/actions/setup-os
253+
with:
254+
packages: 'cmake golang'
255+
- uses: ./.github/actions/setup-aws-lc
256+
with:
257+
repository: 'hanno-becker/aws-lc'
258+
commit: 'mlkem_native'
259+
- name: Run importer
260+
run: |
261+
cd $AWSLC_DIR/crypto/fipsmodule/ml_kem
262+
GITHUB_REPOSITORY=$GITHUB_REPOSITORY GITHUB_SHA=$GITHUB_SHA ./importer.sh
263+
- name: Build AWS-LC (FIPS=1)
264+
run: |
265+
cd $AWSLC_DIR
266+
./tests/ci/run_posix_tests.sh
212267
build_kat:
213268
needs: [quickcheck, quickcheck-windows, quickcheck-c90, quickcheck-lib, examples, lint, lint-markdown-link]
214269
strategy:

0 commit comments

Comments
 (0)