Skip to content

sys/psa_crypto: add monocypher as ed25519 software backend#21822

Merged
mguetschow merged 1 commit intoRIOT-OS:masterfrom
mguetschow:psa-ed25519-monocypher
Nov 10, 2025
Merged

sys/psa_crypto: add monocypher as ed25519 software backend#21822
mguetschow merged 1 commit intoRIOT-OS:masterfrom
mguetschow:psa-ed25519-monocypher

Conversation

@mguetschow
Copy link
Copy Markdown
Contributor

Contribution description

Monocypher offers an implementation of Ed25519 that is much faster than the c25519 implementation, at the cost of higher flash consumption: See Table 4 of https://arxiv.org/pdf/2106.05577

This PR adds monocypher as a PSA Crypto API backend and enables it as default software backend.

Testing procedure

make -C tests/sys/psa_crypto_eddsa all flash test should select monocypher as default on BOARD=native and complete successfully.

On a BOARD=nrf52840dk, we get the following numbers:

$ USEMODULE="psa_asymmetric_ecc_ed25519_custom_backend psa_asymmetric_ecc_ed25519_backend_c25519" make -C tests/sys/psa_crypto_eddsa BOARD=nrf52840dk flash test
...
   text    data     bss     dec     hex
  24052     176    5348   29576    7388
...
EdDSA took 4295262 us
All Done
[TEST PASSED]
$ make -C tests/sys/psa_crypto_eddsa BOARD=nrf52840dk flash test
...
   text    data     bss     dec     hex
  32648     176    5348   38172    951c
...
EdDSA took 73349 us
All Done
[TEST PASSED]

Issues/PRs references

Builds on and includes #21821

@github-actions github-actions bot added Area: tests Area: tests and testing framework Area: pkg Area: External package ports Area: sys Area: System labels Oct 27, 2025
@mguetschow mguetschow added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 27, 2025
@mguetschow mguetschow force-pushed the psa-ed25519-monocypher branch from cdd7e57 to 06f5645 Compare October 27, 2025 17:40
@github-actions github-actions bot removed the Area: tests Area: tests and testing framework label Oct 27, 2025
@riot-ci
Copy link
Copy Markdown

riot-ci commented Oct 27, 2025

Murdock results

✔️ PASSED

7f85d3a sys/psa_crypto: add monocypher as ed25519 software backend

Success Failures Total Runtime
10931 0 10931 13m:32s

Artifacts

@crasbe crasbe added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: waiting for other PR State: The PR requires another PR to be merged first labels Oct 27, 2025
@mguetschow mguetschow force-pushed the psa-ed25519-monocypher branch from 8bba6f7 to c4b71d5 Compare November 4, 2025 07:51
@mguetschow mguetschow removed the State: waiting for other PR State: The PR requires another PR to be merged first label Nov 4, 2025
@mguetschow
Copy link
Copy Markdown
Contributor Author

Rebased this on master after merge of #21821

@crasbe crasbe added this pull request to the merge queue Nov 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2025
@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Nov 7, 2025

at the cost of higher flash consumption

Murdock agrees 👀

diff --git a/tests/sys/psa_crypto/Makefile.ci b/tests/sys/psa_crypto/Makefile.ci
index 5c1a01c4f4..dfd176a483 100644
--- a/tests/sys/psa_crypto/Makefile.ci
+++ b/tests/sys/psa_crypto/Makefile.ci
@@ -1,14 +1,7 @@
 BOARD_INSUFFICIENT_MEMORY := \
-    arduino-duemilanove \
-    arduino-leonardo \
-    arduino-mega2560 \
-    arduino-nano \
-    arduino-uno \
-    atmega328p \
-    atmega328p-xplained-mini \
-    atmega8 \
     bluepill-stm32f030c8 \
     i-nucleo-lrwan1 \
+    nucleo-c031c6 \
     nucleo-f030r8 \
     nucleo-f031k6 \
     nucleo-f042k6 \
@@ -19,6 +12,7 @@ BOARD_INSUFFICIENT_MEMORY := \
     slstk3400a \
     stk3200 \
     stm32c0116-dk \
+    stm32c0316-dk \
     stm32f030f4-demo \
     stm32f0discovery \
     stm32g0316-disco \

@mguetschow
Copy link
Copy Markdown
Contributor Author

Murdock agrees 👀

Kind of - apparently monocypher is also 32-bit only? Anyways, I'll probably need such an update for tests/sys/psa_crypto_eddsa as well :)

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Nov 7, 2025

On it 🫡

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Nov 7, 2025

There you go:

diff --git a/tests/sys/psa_crypto_eddsa/Makefile.ci b/tests/sys/psa_crypto_eddsa/Makefile.ci
index 6a2fca3caf..4e4f6862b6 100644
--- a/tests/sys/psa_crypto_eddsa/Makefile.ci
+++ b/tests/sys/psa_crypto_eddsa/Makefile.ci
@@ -1,14 +1,14 @@
 BOARD_INSUFFICIENT_MEMORY := \
-    arduino-duemilanove \
-    arduino-leonardo \
-    arduino-nano \
-    arduino-uno \
-    atmega328p \
-    atmega328p-xplained-mini \
-    atmega8 \
+    nucleo-c031c6 \
     nucleo-f031k6 \
+    nucleo-f042k6 \
     nucleo-l011k4 \
+    nucleo-l031k6 \
     samd10-xmini \
     stk3200 \
+    stm32c0116-dk \
+    stm32c0316-dk \
     stm32f030f4-demo \
+    stm32g0316-disco \
+    weact-g030f6 \
     #

switch from c25519 to monocypher as default
@mguetschow mguetschow force-pushed the psa-ed25519-monocypher branch from c4b71d5 to 7f85d3a Compare November 10, 2025 08:14
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Nov 10, 2025
@mguetschow mguetschow enabled auto-merge November 10, 2025 08:15
@mguetschow
Copy link
Copy Markdown
Contributor Author

Thanks 🤗 Applied, force-pushed and queued to merge again :)

@mguetschow mguetschow added this pull request to the merge queue Nov 10, 2025
Merged via the queue into RIOT-OS:master with commit 370bb0e Nov 10, 2025
25 checks passed
@mguetschow mguetschow deleted the psa-ed25519-monocypher branch November 10, 2025 10:55
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants