Add EC-SDSA (Schnorr) signatures with SHA-256/SHA-512 support#242
Open
yplo wants to merge 1 commit intokmackay:masterfrom
Open
Add EC-SDSA (Schnorr) signatures with SHA-256/SHA-512 support#242yplo wants to merge 1 commit intokmackay:masterfrom
yplo wants to merge 1 commit intokmackay:masterfrom
Conversation
uECC.h / uECC.c:
- uECC_SUPPORTS_ECDSA macro wraps existing sign/verify block.
- EC-SDSA (Schnorr) sign and verify for two variants:
Optimized: R = Hash(x1 || M)
Standard: R = Hash(x1 || y1 || M)
Shared impl in ecsdsa_sign_impl / ecsdsa_verify_impl (include_y flag).
- Public API: uECC_ecsdsa_sign/verify_optimized, uECC_ecsdsa_sign/verify_standard.
- Three-level preprocessor gates (all default to 1):
uECC_SUPPORTS_ECDSA
uECC_SUPPORTS_ECSDSA_OPTIMIZED
uECC_SUPPORTS_ECSDSA_STANDARD
Set any to 0 to strip the corresponding code from the build.
- bits2int and smax are common helpers kept outside all guards.
uECC_hash.h / uECC_hash.c:
- Self-contained SHA-256 and SHA-512 uECC_HashContext adapters.
- DISABLED BY DEFAULT (uECC_SUPPORTS_SHA256/SHA512 default to 0).
Projects with an existing hash library incur zero cost.
- Each context embeds its own scratch buffer; no heap allocation needed.
test/test_ecsdsa.c:
- Known-answer vector tests for both variants x both hashes
(secp256r1, M = "abc"):
SHA-256 optimized, SHA-256 standard
SHA-512 optimized, SHA-512 standard
- Random round-trip tests: 64 iterations x 5 curves x 2 variants x 2 hashes.
README.md:
- Documents EC-SDSA variants, hash support, and all preprocessor gates.
.gitignore: exclude *.obj and *.exe build artifacts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 macro-preprocessor to enable/disable EC variants (EC-DSA or EC-SDSA) for code size optimisations.
Add new EC variant (EC-SDSA) to uECC.