From 9e01e2c7d9dfdadc653c05e80ed0f6aa235597ff Mon Sep 17 00:00:00 2001 From: J08nY Date: Sun, 1 Oct 2023 22:23:53 +0200 Subject: Add C test to CI. --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fddf6f7..00ae5cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,6 +48,9 @@ jobs: - name: Test run: | make test + - name: Test (C) + run: | + cd test && make test_bn && ./test_bn && cd .. - name: Code coverage uses: codecov/codecov-action@v3 if: ${{ matrix.python-version == 3.9 }} -- cgit v1.3.1 From 4381ab42124180b5b6b5fcfad152c98eb276c772 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 16:18:39 +0200 Subject: Try gcc-10 in CI. --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00ae5cf..a8fc8b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: [push, pull_request] env: LLVM_CONFIG: /usr/bin/llvm-config-10 - OTHER_PACKAGES: swig gcc libpcsclite-dev llvm-10 libllvm10 llvm-10-dev gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi + OTHER_PACKAGES: swig gcc-10 libpcsclite-dev llvm-10 libllvm10 llvm-10-dev gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi jobs: test: @@ -33,6 +33,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y $OTHER_PACKAGES + sudo update-alternatives --set gcc /usr/bin/gcc-10 - name: Build libtommath run: | cd ext && make host stm32f3 && cd .. -- cgit v1.3.1 From 5ebdb255d4b331adbd8784f1fb24ff2f5728f641 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 16:25:29 +0200 Subject: Use ubuntu-latest. --- .github/workflows/test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8fc8b9..df5e96d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,12 +3,12 @@ name: Test on: [push, pull_request] env: - LLVM_CONFIG: /usr/bin/llvm-config-10 - OTHER_PACKAGES: swig gcc-10 libpcsclite-dev llvm-10 libllvm10 llvm-10-dev gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi + LLVM_CONFIG: /usr/bin/llvm-config-14 + OTHER_PACKAGES: swig libpcsclite-dev llvm-14 libllvm14 llvm-14-dev gcc gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: python-version: ["3.8", "3.9", "3.10"] @@ -33,7 +33,6 @@ jobs: run: | sudo apt-get update sudo apt-get install -y $OTHER_PACKAGES - sudo update-alternatives --set gcc /usr/bin/gcc-10 - name: Build libtommath run: | cd ext && make host stm32f3 && cd .. -- cgit v1.3.1 From 957c439e79c9a2fb8f23ef3cf770e3c339c75396 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 16:30:37 +0200 Subject: Try the newer libnewlib in CI. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df5e96d..8c92242 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: [push, pull_request] env: LLVM_CONFIG: /usr/bin/llvm-config-14 - OTHER_PACKAGES: swig libpcsclite-dev llvm-14 libllvm14 llvm-14-dev gcc gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi + OTHER_PACKAGES: swig libpcsclite-dev llvm-14 libllvm14 llvm-14-dev gcc gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi jobs: test: -- cgit v1.3.1 From 94f3a877bf16b98b1b81f251cc4f28260c09e4e8 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 16:47:49 +0200 Subject: Build and run failing config in CI. --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c92242..b075ec7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,6 +45,10 @@ jobs: - name: Install pyecsca-codegen run: | pip install -e ".[test, dev]" + - name: Build test config + run: | + builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . + echo -e "c7010fffffffdffffffffffffffffffffffff6e10fffffffe0000000075a30d1b9038a1156801016110fffffffdfffffffffffffffffffffffc6210e87579c11079f43dd824993c2cee5ed3e7247810161ff7528b899b2d0c28607ca52c5b867910cf5ac8395bafeb13c02da292dded7a83e9036e0101\ng\nx\n" | ./pyecsca-codegen-HOST.elf - name: Test run: | make test -- cgit v1.3.1 From 5752f4da62f638d2e8a713f1ac03eab2d4bc3147 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 17:11:29 +0200 Subject: Run config under valgrind. --- .github/workflows/test.yml | 4 ++-- pyecsca/codegen/templates/mult_sliding_w.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b075ec7..aa6d6c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: [push, pull_request] env: LLVM_CONFIG: /usr/bin/llvm-config-14 - OTHER_PACKAGES: swig libpcsclite-dev llvm-14 libllvm14 llvm-14-dev gcc gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi + OTHER_PACKAGES: swig libpcsclite-dev llvm-14 libllvm14 llvm-14-dev valgrind gcc gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi jobs: test: @@ -48,7 +48,7 @@ jobs: - name: Build test config run: | builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . - echo -e "c7010fffffffdffffffffffffffffffffffff6e10fffffffe0000000075a30d1b9038a1156801016110fffffffdfffffffffffffffffffffffc6210e87579c11079f43dd824993c2cee5ed3e7247810161ff7528b899b2d0c28607ca52c5b867910cf5ac8395bafeb13c02da292dded7a83e9036e0101\ng\nx\n" | ./pyecsca-codegen-HOST.elf + echo -e "c7010fffffffdffffffffffffffffffffffff6e10fffffffe0000000075a30d1b9038a1156801016110fffffffdfffffffffffffffffffffffc6210e87579c11079f43dd824993c2cee5ed3e7247810161ff7528b899b2d0c28607ca52c5b867910cf5ac8395bafeb13c02da292dded7a83e9036e0101\ng\nx\n" | valgrind --track-origins=yes --leak-check=full ./pyecsca-codegen-HOST.elf - name: Test run: | make test diff --git a/pyecsca/codegen/templates/mult_sliding_w.c b/pyecsca/codegen/templates/mult_sliding_w.c index 7321292..1b670e9 100644 --- a/pyecsca/codegen/templates/mult_sliding_w.c +++ b/pyecsca/codegen/templates/mult_sliding_w.c @@ -20,15 +20,15 @@ static void scalar_mult_inner(bn_t *scalar, point_t *point, curve_t *curve, poin {% elif scalarmult.recoding_direction == ProcessingDirection.RTL %} wsliding_t *ws = bn_wsliding_rtl(scalar, {{ scalarmult.width }}); {% endif %} - printf("ws %p\n", ws); - printf("len = %li\n", ws->length); + //printf("ws %p\n", ws); + //printf("len = %li\n", ws->length); for (long i = 0; i < ws->length; i++) { point_dbl(q, curve, q); uint8_t val = ws->data[i]; - printf("i = %li, val = %i\n", i, val); + //printf("i = %li, val = %i\n", i, val); if (val) { - printf("adding %i\n", (val - 1) / 2); + //printf("adding %i\n", (val - 1) / 2); point_accumulate(q, points[(val - 1) / 2], curve, q); } } -- cgit v1.3.1 From 61c3c582269517c397a5d5d81122734b7ef9c7c7 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 17:29:27 +0200 Subject: Build failing config with debug. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa6d6c3..7d77cdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: pip install -e ".[test, dev]" - name: Build test config run: | - builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . + env DEBUG=1 OPT=0 builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . echo -e "c7010fffffffdffffffffffffffffffffffff6e10fffffffe0000000075a30d1b9038a1156801016110fffffffdfffffffffffffffffffffffc6210e87579c11079f43dd824993c2cee5ed3e7247810161ff7528b899b2d0c28607ca52c5b867910cf5ac8395bafeb13c02da292dded7a83e9036e0101\ng\nx\n" | valgrind --track-origins=yes --leak-check=full ./pyecsca-codegen-HOST.elf - name: Test run: | -- cgit v1.3.1 From c8b7d31d90256f75c859005f41f1cf7226e25481 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 17:44:52 +0200 Subject: Upload bad impl to artifact. --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d77cdc..1f07240 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,14 @@ jobs: pip install -e ".[test, dev]" - name: Build test config run: | - env DEBUG=1 OPT=0 builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . + builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . + - name: Upload bad impl + uses: actions/upload-artifact@v3 + with: + name: bad-impl + path: pyecsca-codegen-HOST.elf + - name: Run bad impl + run: | echo -e "c7010fffffffdffffffffffffffffffffffff6e10fffffffe0000000075a30d1b9038a1156801016110fffffffdfffffffffffffffffffffffc6210e87579c11079f43dd824993c2cee5ed3e7247810161ff7528b899b2d0c28607ca52c5b867910cf5ac8395bafeb13c02da292dded7a83e9036e0101\ng\nx\n" | valgrind --track-origins=yes --leak-check=full ./pyecsca-codegen-HOST.elf - name: Test run: | -- cgit v1.3.1 From 135a0ba95497e10fb3b22bef25eaff1d043b0c0b Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 20:37:02 +0200 Subject: Ditch bug-specific CI test. --- .github/workflows/test.yml | 11 ----------- 1 file changed, 11 deletions(-) (limited to '.github') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f07240..797ce52 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,17 +45,6 @@ jobs: - name: Install pyecsca-codegen run: | pip install -e ".[test, dev]" - - name: Build test config - run: | - builder build --platform HOST --red BARRETT --no-remove -v shortw projective add-1998-cmo dbl-1998-cmo "sliding(width=3,recoding_direction=ProcessingDirection.RTL)" . - - name: Upload bad impl - uses: actions/upload-artifact@v3 - with: - name: bad-impl - path: pyecsca-codegen-HOST.elf - - name: Run bad impl - run: | - echo -e "c7010fffffffdffffffffffffffffffffffff6e10fffffffe0000000075a30d1b9038a1156801016110fffffffdfffffffffffffffffffffffc6210e87579c11079f43dd824993c2cee5ed3e7247810161ff7528b899b2d0c28607ca52c5b867910cf5ac8395bafeb13c02da292dded7a83e9036e0101\ng\nx\n" | valgrind --track-origins=yes --leak-check=full ./pyecsca-codegen-HOST.elf - name: Test run: | make test -- cgit v1.3.1