Skip to content

async: forward the mlkem feature to sunset - #68

Merged
mkj merged 1 commit into
mkj:mainfrom
Sergycb:async-mlkem-feature
Nov 11, 2026
Merged

mkj merged 1 commit into
mkj:mainfrom
Sergycb:async-mlkem-feature

Conversation

@Sergycb

@Sergycb Sergycb commented Nov 1, 2026

Copy link
Copy Markdown

sunset gates ML-KEM behind its mlkem feature, but sunset-async depends on sunset with default features, so a no_std user of sunset-async cannot turn it off: Cargo features only add up.

This PR forwards the feature:

  • the workspace entry for sunset gets default-features = false (a member inheriting with workspace = true cannot turn defaults off itself);
  • sunset-async gets mlkem = ["sunset/mlkem"], on by default.

Nothing changes for existing users. The other workspace members keep mlkem through std (demo/common, demo/std, demo/sftp/std, stdasync, fuzz via arbitrary) or through sunset-async's default (sftp, demo/picow). A constrained target can now use sunset-async = { version = "0.6", default-features = false } and keep curve25519-sha256.

Why it matters: on a Cortex-M7 (STM32H743, release, sunset-async 0.6.0) the ML-KEM-768 key exchange is the deepest stack path of the SSH task:

with mlkem without diff
SSH task stack (static) 39 624 13 112 −26 512
.text 188 144 176 540 −11 604
.rodata 23 456 21 832 −1 624

(the "without" build patched sunset-async to default-features = false; stack is a static estimate from the disassembly, following direct calls from the task's poll.) On small MCUs those 26 kB decide whether SSH fits at all.

Checked: cargo check -p sunset-async with and without default features, cargo tree -p sunset-async --no-default-features has no ml-kem, cargo check -p sunset-sftp.

🤖 Generated with Claude Code

sunset-async depended on sunset with default features, so a no_std user
of sunset-async could not disable mlkem: Cargo features only add up.

The workspace entry for sunset now has default-features = false (a member
inheriting with `workspace = true` cannot turn defaults off itself), and
sunset-async gets its own `mlkem` feature, on by default. Nothing changes
for existing users; other workspace members keep mlkem through `std` or
through sunset-async's default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mkj

mkj commented Nov 11, 2026

Copy link
Copy Markdown
Owner

That looks reasonable, thanks. The 26kB stack size is a bit surprising, I would have expected perhaps 10kB. I'll keep an eye out next time I'm looking at that

@mkj
mkj merged commit ab27cac into mkj:main Nov 11, 2026
2 checks passed
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