Skip to content

Conversation

@ThePassionate
Copy link
Contributor

crypto: add ECC support and software ECDSA helpers

Summary

This PR adds a lightweight ECC implementation to the NuttX crypto subsystem, enables ECDSA operations in the software backend, and addresses related build/static-analysis issues. It also updates the Crypto API documentation with a brief ECC/ECDSA note.

Changes Made

  • Add ECC implementation and public API (crypto/ecc.c, include/crypto/ecc.h)
  • Integrate ECC into the crypto build (crypto/Makefile, crypto/CMakeLists.txt)
  • Support exporting generated public keys in both compressed (ECC_BYTES + 1) and uncompressed (X/Y) forms
  • Add software ECDSA command support in crypto/cryptosoft.c
  • Fix a uint-related build warning and resolve static-analysis findings for uninitialized ECC parameters
  • Document ECC/ECDSA briefly in Documentation/components/crypto.rst

Impact

  • Functionality: provides ECC/ECDSA primitives (key generation, ECDH, sign/verify) for consumers that use the new APIs
  • Code Quality: eliminates warnings and static-analysis findings in the ECC path
  • Compatibility: additive only; no changes to existing interfaces or default behavior

Testing

The change set is additive and self-contained; it does not alter existing behavior or core execution paths unless the new ECC/ECDSA interfaces are explicitly used.

@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Area: Crypto Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Jan 21, 2026
@ThePassionate ThePassionate force-pushed the crypto-ecc-docs-only-20260121 branch 3 times, most recently from 428a207 to 6cb5c28 Compare January 21, 2026 07:02
Transplanting the ECC algorithm from https://github.com/jestan/easy-ecc

which is BSD lisence

Signed-off-by: makejian <makejian@xiaomi.com>
Export public keys as separate X and Y coordinates for uncompressed format.

Signed-off-by: makejian <makejian@xiaomi.com>
Add ECDSA sign and verify operations support in cryptosoft backend.

Signed-off-by: makejian <makejian@xiaomi.com>
typedef uint redefined and uint hash been defined in sys/types.h

Signed-off-by: makejian <makejian@xiaomi.com>
1. p.x uninitialized in line 1643
2. l_public.y uninitialized in line 1579
3. l_public.y uninitialized in line 1533
Signed-off-by: makejian <makejian@xiaomi.com>
Add brief documentation for ECC/ECDSA software implementation in the crypto subsystem documentation.

Signed-off-by: makejian <makejian@xiaomi.com>
@ThePassionate ThePassionate force-pushed the crypto-ecc-docs-only-20260121 branch from 6cb5c28 to c764c99 Compare January 21, 2026 07:22
ThePassionate and others added 2 commits January 21, 2026 16:40
Add BSD-2-Clause SPDX license identifier to ECC source and header files.

Signed-off-by: makejian <makejian@xiaomi.com>
Add STRINGIFY and CONCATENATE macro definitions at the beginning of the
file to ensure proper macro expansion. These macros use two-level expansion
to handle cases where macro parameters themselves are macros.

Also improve the EXPAND macro to use variadic macro syntax (x...) to
properly handle multiple arguments, and reorganize macro definitions
for better clarity.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
@ThePassionate ThePassionate force-pushed the crypto-ecc-docs-only-20260121 branch from 5121a49 to ae561e9 Compare January 22, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Crypto Area: Documentation Improvements or additions to documentation Area: OS Components OS Components issues Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants