Skip to content

aes: disable soft backend if not needed - #593

Closed
Freax13 wants to merge 1 commit into
RustCrypto:masterfrom
Freax13:disable-soft-backend
Closed

aes: disable soft backend if not needed#593
Freax13 wants to merge 1 commit into
RustCrypto:masterfrom
Freax13:disable-soft-backend

Conversation

@Freax13

@Freax13 Freax13 commented Sep 8, 2026

Copy link
Copy Markdown

Previously, the soft backend was always enabled even when the target supports one of the accelerated backends. This is a problem because the soft backend uses a lot of memory for the round keys.

Disabling the soft backend when it's not needed saves a lot of memory: On a modern AMD64 system, Aes256Enc now only requires 240 bytes instead of 960 bytes.

@Freax13
Freax13 force-pushed the disable-soft-backend branch from 02ad9ad to 18b1e36 Compare September 8, 2026 12:30
@Freax13
Freax13 marked this pull request as draft September 8, 2026 12:31
@Freax13
Freax13 force-pushed the disable-soft-backend branch 3 times, most recently from 730c540 to 09de661 Compare September 8, 2026 12:44
Previously, the soft backend was always enabled even when the target
supports one of the accelerated backends. This is a problem because the
soft backend uses a lot of memory for the round keys.

Disabling the soft backend when it's not needed saves a lot of memory:
On a modern AMD64 system, Aes256Enc now only requires 240 bytes instead
of 960 bytes.
@Freax13
Freax13 force-pushed the disable-soft-backend branch from 09de661 to a55bdbd Compare September 8, 2026 12:51
@Freax13
Freax13 marked this pull request as ready for review September 8, 2026 12:54
@newpavlov

Copy link
Copy Markdown
Member

I would strongly prefer to implement #191 instead of doing this (also see #578). I especially do not want to introduce build scripts to aes.

@Freax13

Freax13 commented Sep 8, 2026

Copy link
Copy Markdown
Author

I would strongly prefer to implement #191 instead of doing this (also see #578).

Fair enough.

I especially do not want to introduce build scripts to aes.

Initially I implemented this without a build script, but found this to be a bit too verbose: d2143b3.

Let me know if you prefer that approach.

@newpavlov

Copy link
Copy Markdown
Member

Initially I implemented this without a build script, but found this to be a bit too verbose

Yes, this is why we did not implement it as well despite being aware of the problem. :)

@Freax13 Freax13 closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants