nx_ecdsa_p256_sign_test.nx
buildroot/runtime/nx_ecdsa_p256_sign_test.nx
about
nx_ecdsa_p256_sign_smoke.nx -- MONITOR for ECDSA P-256 SIGN.
Sign-then-verify round-trip: pure-NishiLang produces (r, s) for
a known (priv_key, msg_hash) pair, then feeds (priv_key * G, hash,
r, s) to the already-shipped nx_ecdsa_p256_verify. Verify MUST
return OK -- closes the loop that the sign side is producing
substrate-valid signatures.
Test vector: RFC 6979 §A.2.5 NIST P-256 + SHA-256 with the
well-known sample privkey + message hash.
priv = 0xC9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721
hash = SHA-256("sample") = 0xAF2BDBE1AA9B6EC1E2ADE1D694F41FC71A831D0268E9891562113D8A62ADD1BF
Expected r = 0xEFD48B2AACB6A8FD1140DD9CD45E81D69D2C877B56AAF991C34D0EA84EAF3716
Expected s = 0xF7CB1C942D657C41D436C7A1B6E29F65F3E900DBB9AFF4064DC4AB2F843ACDA8
We don't compare against the RFC vector directly (the byte-order
of internal limb representation makes the comparison fiddly); we
instead assert that our sign output VERIFIES against the matching
public key. That's the load-bearing property: sign produces a
signature that the substrate's own verify accepts.
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_u256.nxnx_p256_modn.nxnx_p256_point.nxnx_p256_scalar_mul.nxnx_ecdsa_p256.nxnx_ecdsa_p256_sign.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 31 | func main() -> i64 |