From 9afafaddcd4e606a219cfc2333164449e24e423d Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 10:31:52 +0200 Subject: [PATCH 01/10] XXX --- .github/workflows/py-bindings.yml | 108 ----------------------- .github/workflows/sanitize.yml | 65 -------------- .github/workflows/test.yml | 137 +----------------------------- 3 files changed, 2 insertions(+), 308 deletions(-) delete mode 100644 .github/workflows/py-bindings.yml delete mode 100644 .github/workflows/sanitize.yml diff --git a/.github/workflows/py-bindings.yml b/.github/workflows/py-bindings.yml deleted file mode 100644 index 8db03785..00000000 --- a/.github/workflows/py-bindings.yml +++ /dev/null @@ -1,108 +0,0 @@ -# This file is based on the output of: -# -# maturin generate-ci github --pytest -m bindings/python/Cargo.toml -# -# Using maturin v1.4.0 -name: Py-bindings - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -permissions: - contents: read - -jobs: - linux: - runs-on: ubuntu-latest - strategy: - matrix: - target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml - sccache: 'true' - manylinux: auto - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - - name: pytest - if: ${{ startsWith(matrix.target, 'x86_64') }} - shell: bash - run: | - set -e - pip install mla-archive --find-links dist --force-reinstall - pip install pytest - cd bindings/python && pytest - - windows: - runs-on: windows-latest - strategy: - matrix: - target: [x64, x86] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - architecture: ${{ matrix.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml - sccache: 'true' - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - - name: pytest - shell: bash - run: | - set -e - pip install mla-archive --find-links dist --force-reinstall - pip install pytest - cd bindings/python && pytest - - macos: - runs-on: macos-latest - strategy: - matrix: - target: [x86_64, aarch64] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml - sccache: 'true' - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - - name: pytest - if: ${{ !startsWith(matrix.target, 'aarch64') }} - shell: bash - run: | - set -e - pip install mla-archive --find-links dist --force-reinstall - pip install pytest - cd bindings/python && pytest - diff --git a/.github/workflows/sanitize.yml b/.github/workflows/sanitize.yml deleted file mode 100644 index 20700d18..00000000 --- a/.github/workflows/sanitize.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Ensure repository healthy state over time - -permissions: - contents: read - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - bindings-headers-sync: - # Assert .h and .hpp bindings files are the ones generated - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions-rs/cargo@v1 - with: - command: install - args: cbindgen - - name: Test C header - working-directory: bindings/C - run: cbindgen --config cbindgen_c.toml | diff - mla.h - - name: Test C++ header - working-directory: bindings/C - run: cbindgen --config cbindgen_cpp.toml | diff - mla.hpp - - changelog-format: - # Ensure CHANGELOGs respect the KeepAChangelog format - strategy: - matrix: - changelog: [curve25519-parser, mla, mlar] - include: - - changelog: curve25519-parser - path: curve25519-parser - - changelog: mla - path: mla - - changelog: mlar - path: mlar - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Get ${{ matrix.changelog }} Changelog Entry - uses: mindsers/changelog-reader-action@v2 - id: changelog_reader - with: - # Check format for the last 10 entries - validation_depth: 10 - path: ${{ matrix.path }}/CHANGELOG.md - - name: Information - run: | - echo -e "\e[1mVersion\e[0m ${{ steps.changelog_reader.outputs.version }}" - echo -e "\e[1mStatus\e[0m ${{ steps.changelog_reader.outputs.status }}" - echo -en "\e[1mBody\e[0m" - cat << 'EOF' - ${{ steps.changelog_reader.outputs.changes }} - EOF diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a05bf3d..d23c94dc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,63 +13,6 @@ env: CARGO_TERM_COLOR: always jobs: - build: - strategy: - matrix: - build: [linux, macos, windows] - include: - - build: linux - os: ubuntu-latest - - build: macos - os: macos-latest - - build: windows - os: windows-latest - extension: .exe - - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Build - env: - RUSTFLAGS: -D warnings - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all --exclude mla-fuzz-afl --verbose - - name: Run tests - run: cargo test --all --exclude mla-fuzz-afl --release --verbose - - name: Upload resulting 'mlar' - uses: actions/upload-artifact@v1 - with: - name: ${{ matrix.build }} - path: ./target/release/mlar${{ matrix.extension }} - - long-tests: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Run long tests - run: cd mla && cargo test --release -- --ignored - - all-features: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Run long tests - run: cargo test --all-features --all --exclude mla-fuzz-afl --exclude mla-bindings-c --release - test-bindings-c-cpp-linux: runs-on: ubuntu-latest steps: @@ -108,7 +51,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: # Avoid a regression of Cargo, breaking at link time - toolchain: 1.69 + toolchain: 1.79 default: true target: ${{ matrix.target }} - uses: microsoft/setup-msbuild@v1.0.2 @@ -119,80 +62,4 @@ jobs: working-directory: bindings/C/tests/windows-msvc/ run: ./${{ matrix.msvc_platform }}/${{ matrix.version }}/mla-bindings-test.exe - afl-build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Install dependencies - run: sudo apt-get install llvm - - name: Install cargo-afl binary crate - uses: actions-rs/install@v0.1 - with: - crate: cargo-afl - version: latest - use-tool-cache: true - - name: Test AFL build - env: - RUSTFLAGS: -D warnings - run: cargo afl build - - fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt - - name: Check format - run: cargo fmt --all -- --check - - audit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Security audit - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy - - name: Install dependencies - run: sudo apt-get install llvm - - name: Install cargo-afl binary crate - uses: actions-rs/install@v0.1 - with: - crate: cargo-afl - version: latest - use-tool-cache: true - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-targets -- -D warnings - - publish-dry-run: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Dry-run publish curve25519-parser - run: cd curve25519-parser && cargo publish --dry-run - - name: Dry-run publish mla - run: cd mla && cargo publish --dry-run - - name: Dry-run publish mlar - run: cd mlar && cargo publish --dry-run - \ No newline at end of file + \ No newline at end of file From b8c22431f4539b885fa3d9193037a31d7ae64a9e Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 10:50:49 +0200 Subject: [PATCH 02/10] crate-type lib --- mla/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mla/Cargo.toml b/mla/Cargo.toml index f9ebbb3f..e68e4698 100644 --- a/mla/Cargo.toml +++ b/mla/Cargo.toml @@ -9,7 +9,9 @@ homepage = "https://github.com/ANSSI-FR/MLA" repository = "https://github.com/ANSSI-FR/MLA" readme = "../README.md" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +crate-type = ["lib"] + [dependencies] rand = { version = "0.8", default-features = false, features = ["getrandom", "std"]} From 5aefd137f5db6c1a15b09ff93969a4e388de1dd6 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 10:51:58 +0200 Subject: [PATCH 03/10] crate-type staticlib --- mla/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mla/Cargo.toml b/mla/Cargo.toml index e68e4698..1c40dc3f 100644 --- a/mla/Cargo.toml +++ b/mla/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/ANSSI-FR/MLA" readme = "../README.md" [lib] -crate-type = ["lib"] +crate-type = ["staticlib"] [dependencies] From 2ef7439ae83ffb3042e8cf0cb46ff743e401ba30 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 10:55:21 +0200 Subject: [PATCH 04/10] bindings: staticlib --- bindings/C/Cargo.toml | 2 +- mla/Cargo.toml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bindings/C/Cargo.toml b/bindings/C/Cargo.toml index d1aaa56d..3ece6b63 100644 --- a/bindings/C/Cargo.toml +++ b/bindings/C/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [lib] name = "mla" -crate-type = ["cdylib", "staticlib"] +crate-type = ["staticlib"] [dependencies] mla = { path = "../../mla", version = "1" } diff --git a/mla/Cargo.toml b/mla/Cargo.toml index 1c40dc3f..173aa305 100644 --- a/mla/Cargo.toml +++ b/mla/Cargo.toml @@ -9,10 +9,6 @@ homepage = "https://github.com/ANSSI-FR/MLA" repository = "https://github.com/ANSSI-FR/MLA" readme = "../README.md" -[lib] -crate-type = ["staticlib"] - - [dependencies] rand = { version = "0.8", default-features = false, features = ["getrandom", "std"]} rand_chacha = { version = "0.3", default-features = false} From 8d87bd675a1120c743c89cb8ad3041f8edeb01ee Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 11:04:15 +0200 Subject: [PATCH 05/10] add ntdll.lib --- bindings/C/Cargo.toml | 2 +- bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/C/Cargo.toml b/bindings/C/Cargo.toml index 3ece6b63..d1aaa56d 100644 --- a/bindings/C/Cargo.toml +++ b/bindings/C/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [lib] name = "mla" -crate-type = ["staticlib"] +crate-type = ["cdylib", "staticlib"] [dependencies] mla = { path = "../../mla", version = "1" } diff --git a/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj b/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj index 627d02a4..bdbbd29f 100644 --- a/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj +++ b/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj @@ -175,7 +175,7 @@ Console DebugFull - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;Bcrypt.lib + ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;Bcrypt.lib $(SolutionDir)\..\..\..\..\target\i686-pc-windows-msvc\debug @@ -195,7 +195,7 @@ Console DebugFull - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;Bcrypt.lib + ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;Bcrypt.lib $(SolutionDir)\..\..\..\..\target\i686-pc-windows-msvc\debug @@ -261,7 +261,7 @@ Console DebugFull - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;;Bcrypt.lib + ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;;Bcrypt.lib $(SolutionDir)\..\..\..\..\target\x86_64-pc-windows-msvc\debug @@ -281,7 +281,7 @@ Console DebugFull - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;Bcrypt.lib + ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);Ws2_32.lib;Userenv.lib;Bcrypt.lib $(SolutionDir)\..\..\..\..\target\x86_64-pc-windows-msvc\debug From 780eed68030d5a1a04e7aaa3cdc7de8fd4caa026 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 11:15:35 +0200 Subject: [PATCH 06/10] CI: diplay static libs --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d23c94dc..1cf92756 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,6 +54,8 @@ jobs: toolchain: 1.79 default: true target: ${{ matrix.target }} + - name: "Display necessary libs" + run: cargo rustc -- --print=native-static-libs - uses: microsoft/setup-msbuild@v1.0.2 - name: Compile C/CPP bindings test program for Windows working-directory: bindings/C/tests/windows-msvc/ From 508c8311e1ea1b4d72c88920880564f6b804f479 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 11:17:44 +0200 Subject: [PATCH 07/10] XXX --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1cf92756..7ed0161c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,7 @@ jobs: default: true target: ${{ matrix.target }} - name: "Display necessary libs" + working-directory: bindings/C run: cargo rustc -- --print=native-static-libs - uses: microsoft/setup-msbuild@v1.0.2 - name: Compile C/CPP bindings test program for Windows From e640a79d0ad15b3a838570a72e0586de442b4be6 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 11:27:08 +0200 Subject: [PATCH 08/10] Link ntdll.lib also in release mode --- bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj b/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj index bdbbd29f..35fd3716 100644 --- a/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj +++ b/bindings/C/tests/windows-msvc/mla-bindings-test.vcxproj @@ -219,7 +219,7 @@ true true $(SolutionDir)\..\..\..\..\target\i686-pc-windows-msvc\release - %(AdditionalDependencies);Bcrypt.lib + %(AdditionalDependencies);Bcrypt.lib;ntdll.lib if not exist "$(SolutionDir)\..\..\..\..\target\i686-pc-windows-msvc\release\mla.lib" cargo build --target=i686-pc-windows-msvc --release @@ -242,7 +242,7 @@ true true $(SolutionDir)\..\..\..\..\target\i686-pc-windows-msvc\release - %(AdditionalDependencies);Bcrypt.lib + %(AdditionalDependencies);Bcrypt.lib;ntdll.lib if not exist "$(SolutionDir)\..\..\..\..\target\i686-pc-windows-msvc\release\mla.lib" cargo build --target=i686-pc-windows-msvc --release @@ -305,7 +305,7 @@ true true $(SolutionDir)\..\..\..\..\target\x86_64-pc-windows-msvc\release - %(AdditionalDependencies);Bcrypt.lib + %(AdditionalDependencies);Bcrypt.lib;ntdll.lib if not exist "$(SolutionDir)\..\..\..\..\target\x86_64-pc-windows-msvc\release\mla.lib" cargo build --target=x86_64-pc-windows-msvc --release @@ -328,7 +328,7 @@ true true $(SolutionDir)\..\..\..\..\target\x86_64-pc-windows-msvc\release - %(AdditionalDependencies);Bcrypt.lib + %(AdditionalDependencies);Bcrypt.lib;ntdll.lib if not exist "$(SolutionDir)\..\..\..\..\target\x86_64-pc-windows-msvc\release\mla.lib" cargo build --target=x86_64-pc-windows-msvc --release From 18838479d89f9cf8a049529578dda289bf4fd004 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 11:31:32 +0200 Subject: [PATCH 09/10] Remove force version --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ed0161c..d6041b92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,9 +50,6 @@ jobs: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: - # Avoid a regression of Cargo, breaking at link time - toolchain: 1.79 - default: true target: ${{ matrix.target }} - name: "Display necessary libs" working-directory: bindings/C From 3bc2ff07b8d236c70e1d8fc8498d5457526de5c1 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 17 Jun 2024 11:32:25 +0200 Subject: [PATCH 10/10] Remove force version --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6041b92..38864f34 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,6 +50,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: + toolchain: stable target: ${{ matrix.target }} - name: "Display necessary libs" working-directory: bindings/C