From d8155683c7a1872e355b11ca314c2ebdb80b5b55 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Fri, 15 Mar 2024 13:56:32 +0800 Subject: [PATCH 1/5] Add CI for Dilithium NTT --- .github/workflows/tests.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..c7cd242 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,16 @@ +name: Tests +on: + pull_request: + branches: [ "main" ] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: install dependencies + run: sudo apt install gcc-aarch64-linux-gnu qemu-user + - name: Run tests + run: | + make run-cross-ntt_dilithium From aab60ca8bb11120980d88e4f267ee8c3d4b0499d Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Fri, 15 Mar 2024 14:23:37 +0800 Subject: [PATCH 2/5] add tests for Kyber NTT/X25519/Keccak --- .github/workflows/tests.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c7cd242..4bd706e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -11,6 +11,18 @@ jobs: submodules: true - name: install dependencies run: sudo apt install gcc-aarch64-linux-gnu qemu-user - - name: Run tests + - name: Run Dilithium NTT Tests run: | make run-cross-ntt_dilithium + - name: Run Kyber NTT Tests + run: | + make run-cross-ntt_kyber + - name: Run Kyber NTT Tests + run: | + make run-cross-ntt_kyber + - name: Run X25519 Tests + run: | + make run-cross-x25519 + - name: Run Keccak Tests + run: | + make run-cross-keccak_neon \ No newline at end of file From e0c9a73d9cbc82049a94d8ef406e0914fe40f509 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Thu, 11 Apr 2024 21:39:26 +0800 Subject: [PATCH 3/5] fix compiler errors in Keccak tests --- asm/manual/keccak_f1600/keccak_f1600_variants.h | 2 +- asm/manual/keccak_f1600/third_party/keccakx2_cothan.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/asm/manual/keccak_f1600/keccak_f1600_variants.h b/asm/manual/keccak_f1600/keccak_f1600_variants.h index 400e90f..ded7aa0 100644 --- a/asm/manual/keccak_f1600/keccak_f1600_variants.h +++ b/asm/manual/keccak_f1600/keccak_f1600_variants.h @@ -47,7 +47,7 @@ void keccak_f1600_x2_scalar_C ( uint64_t state[KECCAK_F1600_X2_STATE_SIZE_UI void keccak_f1600_x2_bas ( uint64_t state[KECCAK_F1600_X2_STATE_SIZE_UINT64] ); #include typedef uint64x2_t v128; -void keccak_f1600_x2_neon_C_cothan( v128 state[25] ); +void keccak_f1600_x2_neon_C_cothan( uint64_t stateu64[2*25] ); /* PQAX implementations */ void keccak_f1600_x2_v84a_asm_v1( uint64_t state[KECCAK_F1600_X2_STATE_SIZE_UINT64] ); diff --git a/asm/manual/keccak_f1600/third_party/keccakx2_cothan.c b/asm/manual/keccak_f1600/third_party/keccakx2_cothan.c index 42a1433..4b40055 100644 --- a/asm/manual/keccak_f1600/third_party/keccakx2_cothan.c +++ b/asm/manual/keccak_f1600/third_party/keccakx2_cothan.c @@ -135,8 +135,9 @@ static const uint64_t neon_KeccakF_RoundConstants[NROUNDS] = { * * Arguments: - v128 *state: pointer to input/output Keccak state **************************************************/ -void keccak_f1600_x2_neon_C_cothan(v128 state[25]) +void keccak_f1600_x2_neon_C_cothan(uint64_t stateu64[2*25]) { + v128 *state = (v128 *) stateu64; v128 Aba, Abe, Abi, Abo, Abu; v128 Aga, Age, Agi, Ago, Agu; v128 Aka, Ake, Aki, Ako, Aku; From f23b1e131dfd75ab1d48913693d44664e25121fc Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Thu, 11 Apr 2024 21:41:22 +0800 Subject: [PATCH 4/5] update slothy --- slothy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slothy b/slothy index 4c727f5..d7b5296 160000 --- a/slothy +++ b/slothy @@ -1 +1 @@ -Subproject commit 4c727f513e5c6decf562723d16d65ff70dd6445d +Subproject commit d7b5296d0915369d61e6a235224e88ab0febfb0e From fd00f265b50894fdf06036af9c6db73d67c93927 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Thu, 11 Apr 2024 21:51:59 +0800 Subject: [PATCH 5/5] fix compiler errors --- .github/workflows/tests.yaml | 1 + tests/keccak_neon/manual/keccak_f1600_variants.h | 2 +- tests/keccak_neon/manual/third_party/keccakx2_cothan.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4bd706e..bb54c10 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -25,4 +25,5 @@ jobs: make run-cross-x25519 - name: Run Keccak Tests run: | + make clean make run-cross-keccak_neon \ No newline at end of file diff --git a/tests/keccak_neon/manual/keccak_f1600_variants.h b/tests/keccak_neon/manual/keccak_f1600_variants.h index 400e90f..ded7aa0 100644 --- a/tests/keccak_neon/manual/keccak_f1600_variants.h +++ b/tests/keccak_neon/manual/keccak_f1600_variants.h @@ -47,7 +47,7 @@ void keccak_f1600_x2_scalar_C ( uint64_t state[KECCAK_F1600_X2_STATE_SIZE_UI void keccak_f1600_x2_bas ( uint64_t state[KECCAK_F1600_X2_STATE_SIZE_UINT64] ); #include typedef uint64x2_t v128; -void keccak_f1600_x2_neon_C_cothan( v128 state[25] ); +void keccak_f1600_x2_neon_C_cothan( uint64_t stateu64[2*25] ); /* PQAX implementations */ void keccak_f1600_x2_v84a_asm_v1( uint64_t state[KECCAK_F1600_X2_STATE_SIZE_UINT64] ); diff --git a/tests/keccak_neon/manual/third_party/keccakx2_cothan.c b/tests/keccak_neon/manual/third_party/keccakx2_cothan.c index 42a1433..4b40055 100644 --- a/tests/keccak_neon/manual/third_party/keccakx2_cothan.c +++ b/tests/keccak_neon/manual/third_party/keccakx2_cothan.c @@ -135,8 +135,9 @@ static const uint64_t neon_KeccakF_RoundConstants[NROUNDS] = { * * Arguments: - v128 *state: pointer to input/output Keccak state **************************************************/ -void keccak_f1600_x2_neon_C_cothan(v128 state[25]) +void keccak_f1600_x2_neon_C_cothan(uint64_t stateu64[2*25]) { + v128 *state = (v128 *) stateu64; v128 Aba, Abe, Abi, Abo, Abu; v128 Aga, Age, Agi, Ago, Agu; v128 Aka, Ake, Aki, Ako, Aku;