Skip to content

Optimize software gcm_mult() routines on strictly-aligned systems #9489

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
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

rsaxvc
Copy link

@rsaxvc rsaxvc commented Aug 20, 2024

Description

Micro-optimize gcm_mult_largetable() and gcm_mult_smalltable(), tuning for 32-bit systems and restoring performance on strictly-aligned systems lost as part of #8716 . Some improvement in gcm_mult_smalltable() should also help systems with unaligned accesses as well.

These are cycles measured on an Xtensa core without unaligned accesses.

Implementation Cycles/Block Cycles/Byte
Old gcm_mult() (pre-#8716) 1214 75.88
gcm_mult_smalltable() 4139 258.7
gcm_mult_smalltable() proposed 936 58.5
gcm_mult_largetable() 2168 135.5
gcm_mult_largetable() proposed 599 37.4

PR checklist

  • changelog provided
  • tests covered by existing test cases

Remove type-punning from the inner loop, and do most operations
on uint64_t instead.

Pre-shift last4[] to take advantage of free <<32 on 32-bit machines.

Fixes Mbed-TLS#9476

Signed-off-by: Richard Allen <[email protected]>
@rsaxvc rsaxvc marked this pull request as ready for review August 20, 2024 12:30
@minosgalanakis minosgalanakis added needs-review Every commit must be reviewed by at least two team members, needs-backports Backports are missing or are pending review and approval. component-platform Portability layer and build scripts needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review size-s Estimated task size: small (~2d) labels Aug 21, 2024
@gilles-peskine-arm gilles-peskine-arm added component-crypto Crypto primitives and low-level interfaces priority-medium Medium priority - this can be reviewed as time permits and removed component-platform Portability layer and build scripts labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-crypto Crypto primitives and low-level interfaces needs-backports Backports are missing or are pending review and approval. needs-ci Needs to pass CI tests needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review priority-medium Medium priority - this can be reviewed as time permits size-s Estimated task size: small (~2d)
Projects
Status: In Development
Development

Successfully merging this pull request may close these issues.

3 participants