code wiki / (root) / nx_ed25519_signature.nx

nx_ed25519_signature.nx

buildroot/runtime/nx_ed25519_signature.nx

12516 B366 linesdepth 8pulls 11 transitivereach 833 importersview sourcekind librarytopic ed25519
docsdependenciesstructsconstsfunctions

about

nx_ed25519_signature.nx -- final Ed25519 verify + sign (RFC 8032 §5.1). Phase 0b §I.1.D of the Ed25519 completion arc per docs/NISHI_TLS13_GAP_AUDIT.md. Wires together all four shipped substrate pieces (field T7 + decompress T8 + arith T9 + scalar T10) into the final two callable signatures the rest of the substrate consumes: ed25519_sign(priv32, msg, msg_len, sig_out_64) ed25519_verify_full(pub32, msg, msg_len, sig_64) -> 1/0 Plus the helper sc_muladd that sign needs. Sign (RFC 8032 §5.1.6): 1. H = SHA-512(priv) ; 64 bytes 2. s = clamp(H[0..32]) ; 32 bytes (secret scalar) prefix = H[32..64] ; 32 bytes 3. A = [s]B ; public key A_enc = compress(A) 4. r = sc_reduce(SHA-512(prefix || msg)) ; 32 bytes R = [r]B R_enc = compress(R) ; 32 bytes 5. k = sc_reduce(SHA-512(R_enc || A_enc || msg)) ; 32 bytes 6. S = (k*s + r) mod L = sc_muladd(k, s, r) ; 32 bytes 7. signature = R_enc || S ; 64 bytes Verify (RFC 8032 §5.1.7): 1. Parse sig: R_enc (32) || S (32). Reject if S >= L. 2. Decompress R_enc -> R_pt; decompress pubkey -> A_pt. 3. h = sc_reduce(SHA-512(R_enc || pubkey || msg)) 4. Check: [S]B == R_pt + [h]A_pt (compare via compressed encoding) What it does today: both sign and verify, KAT-verified against RFC 8032 §7.1 TEST 1 (the empty-message vector). What it doesn't do yet: - TEST 2 (1-byte) and TEST 3 (1023-byte) KATs are mechanically the same; we ship TEST 1 to prove correctness and queue TEST 2/3 as exhaustive interop. - Constant-time signing (current sc_reduce is data-independent

dependencies 7 imports · 64 importers

nx_syscalls.nx nx_sha512.nx nx_x25519.nx nx_ed25519_field.nx nx_ed25519_point.nx nx_ed25519_arith.nx nx_ed25519_scalar.nx nx_ed25519_signature.nx _drv_f1_gate.nx _drv_f2_gate.nx _ed25519_rfc8032_kat.nx _ed25519_sign_verify_smoke.nx _h2_multistream_curl_daemon.nx _h2_serve_curl_daemon.nx _h2_serve_loopback_gate.nx _nx_pub_from_priv_isolated_test.nx _sha512_kat.nx nx_access_pep_gate.nx

diagram shows first 10 each side; +0 more imports, +54 more importers in the complete lists below.

imports: nx_syscalls.nxnx_sha512.nxnx_x25519.nxnx_ed25519_field.nxnx_ed25519_point.nxnx_ed25519_arith.nxnx_ed25519_scalar.nx

imported by: _drv_f1_gate.nx_drv_f2_gate.nx_ed25519_rfc8032_kat.nx_ed25519_sign_verify_smoke.nx_h2_multistream_curl_daemon.nx_h2_serve_curl_daemon.nx_h2_serve_loopback_gate.nx_nx_pub_from_priv_isolated_test.nx_sha512_kat.nxnx_access_pep_gate.nxnx_asset_exceed_gate.nxnx_asset_provenance.nxnx_asset_provenance_gate.nxnx_asset_signals_gate.nxnx_cert_gen.nxnx_cms_tls_gate.nxnx_coe_dsse.nxnx_coe_frame.nxnx_device_cert.nxnx_device_cert_gate.nxnx_doc_seal.nxnx_ed25519_sign_bisect_test.nxnx_ed25519_signature_test.nxnx_email_auth.nxnx_emitted_substrate.nxnx_evattest.nxnx_fed_registry.nxnx_fw_capsule.nxnx_h2_test_leaf.nxnx_handshake_crypto_bench.nxnx_https_get_happy_test.nxnx_ingest_foundation.nxnx_install_attest_signed.nxnx_jose.nxnx_library_gate_handle.nxnx_library_gate_test.nxnx_library_publish.nxnx_library_scholarly.nxnx_mtls_authz.nxnx_mtls_identity.nxnx_mtls_pkcs12.nxnx_no_cookie_session.nxnx_pub_reader_receipt.nxnx_pub_receipt.nxnx_pub_receipt_gate.nxnx_pub_receipt_keys.nxnx_pub_receipt_keys_gate.nxnx_spore_sign_gate.nxnx_ssh_kex.nxnx_ssh_lib.nxnx_succession_recover.nxnx_telemetry.nxnx_tls13_client_verify_cv.nxnx_tls13_server_clientauth.nxnx_tls13_server_recv_client_cv.nxnx_tls13_server_session_emit_cv.nxnx_user_account_store.nxnx_x509_build.nxnx_x509_csr_emit.nxnx_x509_leaf_emit.nxnx_x509_pubkey_ed_kat.nxnx_x509_validate.nxnx_x509_validate_test.nxnx_x509_verify_under_issuer.nx

structs

none

consts

68const NX_ED25519_SIG_OK: i64 = 1
69const NX_ED25519_SIG_BAD: i64 = 0

functions

75func ed25519_s_lt_l(s_32: *u8) -> i64
called by 1: ed25519_verify_full calls 1: sys_mmap
98func ed25519_basepoint_p3(out: *GeP3) -> i64
110func ed25519_sha512(msg: *u8, msg_len: i64, out_64: *u8) -> i64
120func ed25519_sha512_3(
147func sc_muladd(out_32: *u8, a_32: *u8, b_32: *u8, c_32: *u8) -> i64
called by 1: ed25519_sign_full calls 2: sys_mmapsc_reduce
207func ed25519_sign_full(
270func ed25519_verify_full(
331func ed25519_pub_from_priv(priv_32: *u8, pub_32_out: *u8) -> i64