Support for Curve25519 non-blocking cryptography (based on PR #5764)#9721
Open
dgarske wants to merge 2 commits intowolfSSL:masterfrom
Open
Support for Curve25519 non-blocking cryptography (based on PR #5764)#9721dgarske wants to merge 2 commits intowolfSSL:masterfrom
dgarske wants to merge 2 commits intowolfSSL:masterfrom
Conversation
e8fc0a8 to
50dea8f
Compare
Contributor
|
Jenkins retest this please - CI issue PRB-Master-Job |
Contributor
Author
|
Jenkins retest this please |
## Summary - Add non-blocking (incremental) Curve25519 key generation and shared secret via `WC_X25519_NONBLOCK`, modeled after the existing ECC non-blocking pattern (`WC_ECC_NONBLOCK`) - Implement `curve25519_nb()` and `fe_inv__distinct_nb()` in `fe_low_mem.c` as state-machine variants that return `FP_WOULDBLOCK` to yield after each field multiply - Add `wc_curve25519_set_nonblock()` API to attach/detach non-blocking context to a key - Integrate X25519 non-blocking with TLS 1.2/1.3 key share generation and shared secret in `tls.c` and `internal.c` (behind `WC_X25519_NONBLOCK && WOLFSSL_ASYNC_CRYPT_SW`) - Add `--enable-curve25519=nonblock` configure option (auto-enables `--enable-asynccrypt` and `--enable-asynccrypt-sw`) - Add X25519 async software dispatch cases in `async.c` and types in `async.h` - Fix async guard in `curve25519.c` to require `WOLFSSL_ASYNC_CRYPT_SW` (matching other algorithms) - Overhaul `examples/async/` client/server: non-blocking I/O via `WOLFSSL_USER_IO`, standalone `Makefile`, X25519/ECC mode selection, CI-friendly ready-file sync - Add `examples/configs/user_settings_curve25519nonblock.h` and CI coverage in `os-check.yml` and new `async-examples.yml` workflow - Add wolfcrypt test and API test coverage for X25519 non-blocking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add X25519 Non-Blocking Support
Description
This PR adds non-blocking (yield) support for X25519 (Curve25519) key generation and shared secret operations, similar to the existing
WC_ECC_NONBLOCKsupport for ECC operations.Changes
New Features:
WC_X25519_NONBLOCKconfiguration macro to enable non-blocking X25519 operationsx25519_nb_ctx_tcontext structure to track non-blocking operation statewc_curve25519_set_nonblock()API to configure non-blocking mode on a keywc_curve25519_make_key()- key generationwc_curve25519_shared_secret()- ECDH shared secret computationFiles Modified:
src/internal.c- Added X25519 non-blocking context allocation/deallocation in TLSAllocKey/FreeKeywolfcrypt/src/curve25519.c- Added non-blocking key generation and shared secret functionswolfcrypt/src/fe_low_mem.c- Addedcurve25519_nb()andfe_inv__distinct_nb()non-blocking implementationswolfcrypt/test/test.c- Addedx25519_nonblock_test()and async wait calls for X25519 operationswolfssl/wolfcrypt/curve25519.h- Addedx25519_nb_ctx_tstruct andwc_curve25519_set_nonblock()APIwolfssl/wolfcrypt/fe_operations.h- Added non-blocking function declarationsRequirements
CURVE25519_SMALL(enabled via--enable-curve25519=small)WC_X25519_NONBLOCKis used withoutCURVE25519_SMALLTesting
Build command:
Run tests:
Expected output should include:
Alternative build (with debugging output):
This will print iteration counts for non-blocking operations:
API Usage Example