fix error in GCC bswap #649

Merged
daverodgman merged 1 commit from gcc_bswap_fix into development 2026-02-11 10:08:45 -06:00
daverodgman commented 2026-01-12 04:24:01 -06:00 (Migrated from github.com)

Description

The gcc detection for some reason depended on __GNUC_PREREQ, which was undefined (AIUI it comes from a header which isn't included here). Replace with MBEDTLS_GCC_VERSION.

Presumably size & performance-affecting (I haven't properly measured, but observed eg 17% improvement from this patch in benchmark ctr_drbg) but not a functional change. Improves AES-GCM by around 20-25%.

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 not required because: no functional change
  • framework PR not affected
  • mbedtls development PR this PR
  • mbedtls 3.6 PR https://github.com/Mbed-TLS/mbedtls/pull/10589
  • tests not required because: already tested / no functional change
## Description The gcc detection for some reason depended on `__GNUC_PREREQ`, which was undefined (AIUI it comes from a header which isn't included here). Replace with `MBEDTLS_GCC_VERSION`. Presumably size & performance-affecting (I haven't properly measured, but observed eg 17% improvement from this patch in `benchmark ctr_drbg`) but not a functional change. Improves AES-GCM by around 20-25%. ## 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. - [x] **changelog** not required because: no functional change - [x] **framework PR** not affected - [x] **mbedtls development PR** this PR - [x] **mbedtls 3.6 PR** https://github.com/Mbed-TLS/mbedtls/pull/10589 - [x] **tests** not required because: already tested / no functional change
gilles-peskine-arm (Migrated from github.com) approved these changes 2026-01-13 09:54:26 -06:00
gilles-peskine-arm (Migrated from github.com) left a comment

Thanks, LGTM with some very casual look at Godbolt

Thanks, LGTM with some very casual look at [Godbolt](https://godbolt.org/#z:OYLghAFBqRAWIDGB7AJgUwKKoJYBdkAnAGhxAgDMcAbdAOwEMBbdEAcgEY3iLk68Ayoga0QHACw8%2BeAKoBndAAUAHuwAM3AFZji1BnVAB9Y4mILaiPDj7l6qAMLJqAVyZ0QANkl2AMjjroAHKuAEbohGIATBzEAA7I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AsxzAlWSLYBKwx3AxF8IySYvQYhZCSHwW/OhX%2BVAmD0YoLRL98DtBDBOCNA6AX4XKAGDCdCP6/5gFQEf79BQE/7fLFDn6i5LBiAc5c485G6C5sCgqCQeAoRhS5j5jiDnCCTnAcDrjYD4BEAUjrAcDTDcDS415y4ICESxCNQq4QBq65KBDMDLDKCEHEFdykF3gqjnB77EBMh0FH6oA6Bd6CDCCiD95KFD4qBG5j7EDYRzKxBO5YFsDc7EC87854FCiNRcGljICYjCFEEkErzkGUHUEQAQJK7QKPBMEsEy5BLEB1JiD7jnDEYHjj7sDiDcBMABFqAmG4HsDcCB4xCsEaC%2BFF6oLuDiBAA%3D)
davidhorstmann-arm (Migrated from github.com) approved these changes 2026-02-10 11:20:49 -06:00
davidhorstmann-arm (Migrated from github.com) left a comment

LGTM, thanks!

LGTM, thanks!
davidhorstmann-arm commented 2026-02-10 11:22:52 -06:00 (Migrated from github.com)

Sorry about this, the CI is failing because we've moved PSASIM (it was passing but I accidentally retriggered it while trying to start the other one - my bad). Would you mind rebasing this PR on the latest development? (The 3.6 PR is fine as-is.)

Sorry about this, the CI is failing because we've moved PSASIM (it was passing but I accidentally retriggered it while trying to start the other one - my bad). Would you mind rebasing this PR on the latest `development`? (The 3.6 PR is fine as-is.)
Sign in to join this conversation.
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!649
No description provided.