Skip to content

[mldsa] Remove stack indirection from all operations.#210

Draft
jadephilipoom wants to merge 4 commits intojadep/mldsa-code-size-improvementsfrom
jadep/mldsa-remove-stack-indirection
Draft

[mldsa] Remove stack indirection from all operations.#210
jadephilipoom wants to merge 4 commits intojadep/mldsa-code-size-improvementsfrom
jadep/mldsa-remove-stack-indirection

Conversation

@jadephilipoom
Copy link
Collaborator

This PR is on top of #208 and should only be merged once that one is merged.

The first commit is from #206 and can be removed when the base branch changes to expo/master.

Drops the stack abstraction entirely from the ML-DSA implementations. This saves significant code size (checked for ML-DSA-87):

  • 188 bytes for keygen
  • 204 bytes for verify
  • 324 bytes for sign

It also makes things a tiny bit faster (but the improvements are just a few instructions; the code size is the main thing).

This allows a little more flexibility with how the random value is sourced; it
allows tests to provide a predetermined random value, while runtime binaries
could still populate this with 0 or RND.

Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
Handling memory directly rather than through a stack abstraction slightly
improves performance and saves 324B of IMEM and 192B of DMEM for ML-DSA-87.

Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
Saves 204B of IMEM and slightly improves performance.

Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
Slightly improves performance (0.04% to 0.08% speedup for keygen) and saves
188B of code size.

Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
@jadephilipoom jadephilipoom force-pushed the jadep/mldsa-remove-stack-indirection branch from 0ff0ef0 to cce1ffd Compare March 2, 2026 15:33
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.

1 participant