AES-GCM size and perf #702

Open
daverodgman wants to merge 83 commits from daverodgman/aesgcm into development
daverodgman commented 2026-03-01 10:40:31 -06:00 (Migrated from github.com)

Description

Size and perf improvements for AES-GCM.

Compared to v1.0.0:

  • Neon performance increases by around 2.4x - 3.7x
  • Scalar improves by 4-10%
  • With MBEDTLS_AESCE_OPTIMISE_FOR_SIZE set, performance is +2-5% (clang) / 35% better (gcc) than v1.0.0, and size improves by around 750 bytes (clang) / 1400 bytes (gcc).
  • Both size and perf improve in all cases

Neon performance is about 50% faster than OpenSSL.

This is based on #664.

Relative to v1.0.0:

cc AESCE ONLY_128 OPT_SIZE size AES-GCM-128 AES-GCM-192 AES-GCM-256
clang-17 0 0 0 9232 -532 270 +4% 248 +4% 228 +4%
clang-17 0 1 0 8968 -336 270 +5%
clang-17 1 0 1 2890 -761 3199 +2% 3193 +3% 3173 +4%
clang-17 1 0 0 3598 -53 8820 2.8x 8030 2.6x 7281 2.4x
clang-17 1 1 1 2702 -745 3224 +3%
clang-17 1 1 0 3374 -73 8970 2.9x
gcc-15 0 0 0 10012 -708 277 +10% 253 +9% 232 +10%
gcc-15 0 1 0 9660 -660 277 +10%
gcc-15 1 0 1 4150 -1352 3186 +34% 3177 +35% 3166 +34%
gcc-15 1 0 0 5130 -372 8892 3.7x 8253 3.5x 7671 3.3x
gcc-15 1 1 1 3930 -1400 3211 +30%
gcc-15 1 1 0 4810 -520 8908 3.6x

PR checklist

Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.

  • changelog provided
  • framework PR not required
  • mbedtls development PR provided - this is it
  • mbedtls 3.6 PR not required because: no functional change.
  • tests not required because: already well tested
## Description Size and perf improvements for AES-GCM. Compared to v1.0.0: - Neon performance increases by around 2.4x - 3.7x - Scalar improves by 4-10% - With `MBEDTLS_AESCE_OPTIMISE_FOR_SIZE` set, performance is +2-5% (clang) / 35% better (gcc) than v1.0.0, and size improves by around 750 bytes (clang) / 1400 bytes (gcc). - Both size and perf improve in all cases Neon performance is about 50% faster than OpenSSL. This is based on #664. Relative to v1.0.0: | cc | AESCE | ONLY_128 | OPT_SIZE | size | AES-GCM-128 | AES-GCM-192 | AES-GCM-256 | |----------|-------|----------|----------|---------------|--------------|--------------|--------------| | clang-17 | 0 | 0 | 0 | 9232 -532 | 270 +4% | 248 +4% | 228 +4% | | clang-17 | 0 | 1 | 0 | 8968 -336 | 270 +5% | | | | clang-17 | 1 | 0 | 1 | 2890 -761 | 3199 +2% | 3193 +3% | 3173 +4% | | clang-17 | 1 | 0 | 0 | 3598 -53 | 8820 2.8x | 8030 2.6x | 7281 2.4x | | clang-17 | 1 | 1 | 1 | 2702 -745 | 3224 +3% | | | | clang-17 | 1 | 1 | 0 | 3374 -73 | 8970 2.9x | | | | gcc-15 | 0 | 0 | 0 | 10012 -708 | 277 +10% | 253 +9% | 232 +10% | | gcc-15 | 0 | 1 | 0 | 9660 -660 | 277 +10% | | | | gcc-15 | 1 | 0 | 1 | 4150 -1352 | 3186 +34% | 3177 +35% | 3166 +34% | | gcc-15 | 1 | 0 | 0 | 5130 -372 | 8892 3.7x | 8253 3.5x | 7671 3.3x | | gcc-15 | 1 | 1 | 1 | 3930 -1400 | 3211 +30% | | | | gcc-15 | 1 | 1 | 0 | 4810 -520 | 8908 3.6x | | | ## PR checklist Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line. If the provided content is part of the present PR remove the # symbol. - [ ] **changelog** provided - [ ] **framework PR** not required - [ ] **mbedtls development PR** provided - this is it - [ ] **mbedtls 3.6 PR** not required because: no functional change. - [ ] **tests** not required because: already well tested
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'daverodgman/aesgcm:daverodgman/aesgcm'
git switch 'daverodgman/aesgcm'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'development'
git merge --no-ff 'daverodgman/aesgcm'
git switch 'daverodgman/aesgcm'
git rebase 'development'
git switch 'development'
git merge --ff-only 'daverodgman/aesgcm'
git switch 'daverodgman/aesgcm'
git rebase 'development'
git switch 'development'
git merge --no-ff 'daverodgman/aesgcm'
git switch 'development'
git merge --squash 'daverodgman/aesgcm'
git switch 'development'
git merge --ff-only 'daverodgman/aesgcm'
git switch 'development'
git merge 'daverodgman/aesgcm'
git push origin 'development'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto!702
No description provided.