Repository navigation
sm4.c: use the common GHASH path for SM4-GCM on ARM assembly builds #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SparkiDev
wants to merge
1
commit into
wolfSSL:master
Choose a base branch
from
SparkiDev:sm4_gcm_arm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| name: SM AArch64 Assembly Test | ||
|
|
||
| # The ShangMi code has target specific paths that none of the other workflows | ||
| # reach: they all run on x86_64 and none enables WOLFSSL_ARMASM. SM4-GCM in | ||
| # particular borrows wolfSSL's GHASH from aes.c, whose ARM build keeps the hash | ||
| # subkey in a different representation and reflects it inside the bulk assembly | ||
| # rather than in the caller. This job builds for aarch64 and runs the SM | ||
| # self-tests there, so that the GHASH subkey handling and the non-12-byte nonce | ||
| # path - where the initial counter is itself a GHASH - stay covered. | ||
| # | ||
| # Built with the aarch64 cross toolchain and run under qemu-user, which is how | ||
| # wolfSSL's own multi-arch workflow covers this architecture. A native | ||
| # ubuntu-*-arm runner would also work and is faster, at the cost of being a | ||
| # different runner pool from every other job here. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ '**' ] | ||
| pull_request: | ||
| branches: [ 'main', 'master', 'release/**' ] | ||
| schedule: | ||
| - cron: '0 5 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| resolve: | ||
| uses: ./.github/workflows/_resolve-wolfssl.yml | ||
|
|
||
| build: | ||
| name: aarch64 ${{ matrix.config.name }} (wolfSSL ${{ matrix.wolfssl-ref }}) | ||
| needs: resolve | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| wolfssl-ref: ${{ fromJson(needs.resolve.outputs.refs) }} | ||
| config: | ||
| # The assembly build is the point of this workflow. | ||
| - name: armasm | ||
| flags: '--enable-armasm' | ||
| - name: armasm-sp-asm | ||
| flags: '--enable-armasm --enable-sp --enable-sp-asm' | ||
| # Same vectors, same architecture, C code only: tells an assembly | ||
| # fault apart from something that is wrong on aarch64 generally. | ||
| - name: c-only | ||
| flags: '' | ||
| env: | ||
| SM_FLAGS: >- | ||
| --enable-sm3 --enable-sm4-ecb --enable-sm4-cbc --enable-sm4-ctr | ||
| --enable-sm4-gcm --enable-sm4-ccm --enable-sm2 | ||
| QEMU_LD_PREFIX: /usr/aarch64-linux-gnu | ||
| steps: | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y autoconf automake libtool \ | ||
| crossbuild-essential-arm64 qemu-user qemu-user-binfmt | ||
|
|
||
| - name: Checkout wolfsm | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Build wolfSSL with wolfsm for aarch64 | ||
| run: | | ||
| set -euo pipefail | ||
| git clone --depth 1 --branch ${{ matrix.wolfssl-ref }} \ | ||
| https://github.com/wolfSSL/wolfssl.git ../wolfssl | ||
| ./install.sh ../wolfssl | ||
| cd ../wolfssl | ||
| ./autogen.sh | ||
| ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc \ | ||
| $SM_FLAGS ${{ matrix.config.flags }} | ||
| make -j"$(nproc)" | ||
|
|
||
| - name: wolfCrypt test (SM2/SM3/SM4 algorithm self-tests) | ||
| working-directory: ../wolfssl | ||
| run: ./wolfcrypt/test/testwolfcrypt | ||
|
|
||
| - name: SM benchmark | ||
| working-directory: ../wolfssl | ||
| run: ./wolfcrypt/benchmark/benchmark -sm2 -sm3 -sm4-cbc -sm4-gcm -sm4-ccm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.