micro-ecc-integration
Skill36 starsChanged 5 months agoMITView on GitHub
Use when integrating, porting, or debugging micro-ecc (uECC) ECDH, ECDSA, key generation, uECC_set_rng, signatures, curve selection, or key/signature byte formats on an MCU
In this repository75 other files it gives its agents.
- 8051-mcu-debugSkill
- avem-integrationSkill
- battery-charger-fuel-gauge-integrationSkill
- ble-gatt-integrationSkill
- bootloader-debugSkill
- canbus-integrationSkill
- canopen-integrationSkill
- cellular-at-modem-integrationSkill
- cmbacktrace-integrationSkill
- cmsis-dsp-integrationSkill
- cortex-m-debugSkill
- cortex-r5-debugSkill
- crc-checksum-integrationSkill
- easylogger-integrationSkill
- embedded-app-example-libsSkill
- embedded-buffer-queue-libsSkill
- embedded-data-parsing-libsSkill
- embedded-debug-entrySkill
- embedded-fault-debugSkill
- embedded-framework-libsSkill
- embedded-input-libsSkill
- embedded-library-entrySkill
- embedded-linux-login-debugSkill
- embedded-peripheral-bringupSkill
- embedded-serial-log-debugSkill
- embedded-state-machine-libsSkill
- embedded-timing-libsSkill
- epd-integrationSkill
- esp-idf-integrationSkill
- fatfs-integrationSkill
- flashdb-integrationSkill
- freemodbus-integrationSkill
- freertos-kernel-debugSkill
- freertos-plus-tcp-integrationSkill
- gnss-gps-integrationSkill
- hardware-interface-debugSkill
- heatshrink-integrationSkill
- letter-shell-integrationSkill
- littlefs-integrationSkill
- low-power-debugSkill
- lvgl-integrationSkill
- lwip-integrationSkill
- mbedtls-integrationSkill
- mcuboot-integrationSkill
- mcu-flashing-debugSkill
- miniz-integrationSkill
- mqtt-embedded-integrationSkill
- nanopb-integrationSkill
- nrf-connect-sdk-integrationSkill
- nr-micro-shell-integrationSkill
- openocd-jlink-stlink-debugSkill
- openthread-integrationSkill
- ota-update-integrationSkill
- plooc-integrationSkill
- power-management-integrationSkill
- qspi-xip-flash-debugSkill
- readme-writingSkill
- riscv-mcu-debugSkill
- rtos-debugSkill
- rt-thread-integrationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use this skill for full TLS stacks.
- Distinctive: line 30
Test vector, signature, or verification failure details, and the return code seen.
- Very specific: line 53
Do not log private keys, the ECDSA nonce, or the shared secret from uECC_shared_secret.
- Distinctive: line 68
Before claiming micro-ecc works:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
micro-ecc Integration
Overview
Use this skill to integrate micro-ecc (kmackay/micro-ecc, header uECC.h) by treating randomness, key storage, curve choice, and test vectors as security-critical. ECC that compiles but never called uECC_set_rng() or uses mismatched key byte formats is not working. The core key generation, signing, verification, and ECDH functions return 1 on success and 0 on failure (uECC_verify returns 1 only for a valid signature); the size-query helpers instead return a byte count, and uECC_compress/uECC_decompress return void.
When To Use
Use this skill when:
- The user wants ECDH (
uECC_shared_secret), ECDSA (uECC_sign/uECC_verify), or key generation (uECC_make_key) on an MCU using micro-ecc. - The issue involves
uECC_make_key/uECC_signreturning0, bad signatures, key mismatch, RNG, curve selection, endian/format mismatch, or slow scalar multiplication. - The project uses
uECC.h,uECC.c, auECC_Curve, oruECC_set_rng.
Do not use this skill for full TLS stacks. Use mbedtls-integration for TLS. For AES/SHA/HMAC primitives, use tinycrypt-integration.
First Questions
Ask for:
- Curve and operation:
uECC_secp160r1,uECC_secp192r1,uECC_secp224r1,uECC_secp256r1, oruECC_secp256k1; and ECDH vs ECDSA. - Target MCU, compiler, and whether a hardware TRNG/crypto peripheral exists.
- The RNG source wired into
uECC_set_rng()and the key storage policy. - Public/private key byte format and endian expectations of the peer (
uECC_VLI_NATIVE_LITTLE_ENDIANsetting, compressed vs uncompressed). - Test vector, signature, or verification failure details, and the return code seen.
Integration Checklist
- Choose curve deliberately.
Pick a
uECC_CurveviauECC_secp256r1()(or the peer's curve) and enable it with the matchinguECC_SUPPORTS_secp256r1macro. Disable unused curves to save flash. - Provide a real RNG first.
Register
uECC_set_rng(uECC_RNG_Function fn)wherefnhas signatureint fn(uint8_t *dest, unsigned size)and returns1whendestis filled with good entropy,0otherwise. Without a valid RNG, bothuECC_make_keyanduECC_signreturn0. OnlyuECC_sign_deterministic(RFC 6979-style deterministic nonce, needs auECC_HashContext) works without an RNG. - Size every buffer from the curve.
Always use
uECC_curve_private_key_size(curve)anduECC_curve_public_key_size(curve)instead of hard-coded lengths or arithmetic on each other. The public key isx||yand equalsuECC_curve_public_key_size(curve); the private key equalsuECC_curve_private_key_size(curve). These are equal to 2x the field size and 1x the field size respectively for every curve EXCEPTsecp160r1, where the private key is 21 bytes (the order needs an extra byte; the leading byte is often0x00) while the public key is 40 bytes. Never derive public-key or signature length from the private-key length. - Match key/signature byte format.
Default is big-endian; public keys are raw
x||ywith NO0x04uncompressed prefix, so prepend0x04for SEC1/OpenSSL peers. If interop breaks, checkuECC_VLI_NATIVE_LITTLE_ENDIANmatches both sides; keys/signatures across the two settings are incompatible. The signature isr||sand its length equals the public-key length (uECC_curve_public_key_size(curve)) -- forsecp160r1that is 40 bytes, not2 * private_key_size(peers such as python-ecdsa may instead expect 42). - Sign the hash, not the message.
uECC_sign(private_key, hash, hash_size, signature, curve)anduECC_verifytake a message digest plushash_size; hash the message yourself (e.g. SHA-256) and pass the digest. A hash longer than the curve order is truncated internally. - Handle compressed points if needed.
With
uECC_SUPPORT_COMPRESSED_POINT, useuECC_compress/uECC_decompress; a compressed point is one coordinate plus a leading parity byte, i.e.(uECC_curve_public_key_size(curve) / 2) + 1bytes. Validate imported keys withuECC_valid_public_key. - Protect secrets.
Do not log private keys, the ECDSA nonce, or the shared secret from
uECC_shared_secret.
Common Failures
uECC_set_rng()never called, souECC_make_key/uECC_signsilently return0.- RNG callback returns
0(or returns success while producing weak/deterministic bytes) in production. - Public key sent with or expecting a
0x04prefix; micro-ecc uses rawx||ywithout it. secp160r1private key allocated as 20 bytes instead of 21, corrupting adjacent memory or the key.- Deriving signature or public-key length from the private-key length; on
secp160r1this over-allocates (42 vs 40) and breaks interop. uECC_VLI_NATIVE_LITTLE_ENDIANmismatch between device and peer, so byte order flips and verify fails.- Passing the raw message to
uECC_sign/uECC_verifyinstead of the digest, or hashing inconsistently between the two sides. - Curve mismatch: device built with
uECC_secp256r1but server usessecp256k1.
Verification
Before claiming micro-ecc works:
- State the
uECC_Curve, operation, key/signature byte layout, and the RNG registered viauECC_set_rng. - Confirm
uECC_make_keyreturns1and buffers were sized withuECC_curve_public_key_size/uECC_curve_private_key_size(not derived from each other). - Confirm known test vectors pass:
uECC_verifyreturns1for a valid signature and0for tampered data/hash. - For ECDH, confirm both peers derive the same
uECC_shared_secret. - Confirm secrets are not logged and storage policy is explicit.
Example
User:
micro-ecc 签名服务器验不过。Agent:
- Asks for the curve, whether the public key carries a
0x04prefix, the hash input touECC_sign, the RNG behinduECC_set_rng, and theuECC_VLI_NATIVE_LITTLE_ENDIANsetting on both sides. - Checks endian and that a digest (not the raw message) is passed, and reconstructs the peer's SEC1 format by prepending
0x04to thex||ypublic key. - Verifies with a known vector via
uECC_verifybefore changing protocol code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

