code wiki / (root) / nx_h2_test_leaf.nx

nx_h2_test_leaf.nx

buildroot/runtime/nx_h2_test_leaf.nx

7715 B160 linesdepth 12pulls 38 transitivereach 1 importersview sourcekind tooltopic h2
docsdependenciesstructsconstsfunctions

about

nx_h2_test_leaf.nx -- TUTOR-BOOTSTRAP SCAFFOLD (Claude, B1 rung(6) R4-H2-009), NOT credited as team self-authoring (EoE back-fill owed). SHARED self-signed Ed25519 X.509 LEAF (SAN=localhost) minter + PEM exporter for the h2 INTEROP TEST harnesses. Rule 15 (DRY through shared libraries): the identical self-signed-leaf + PEM-export + civil-date code was COPY-PASTED into _h2_serve_loopback_gate.nx (hsl_*), _h2_serve_curl_daemon.nx (hcd_*) AND _h2_multistream_curl_daemon.nx (mcd_*) -- 3 copies = the rule-15 "extract" trigger. This organ is that extraction; new harnesses COMPOSE it instead of a 4th copy. (The 3 existing copies stay BYTE-UNTOUCHED for now -- migrating them is an additive follow-on so the proven daemons are not disturbed this rung.) CONTRACT: h2tl_make_cert(out_cert_der: *u8, out_cert_len: *i64, out_priv: *u8) -> i64 mint an Ed25519 keypair + self-signed leaf (CN/SAN=localhost, notBefore now-1d, notAfter now+365d). out_cert_der must be >=8192 bytes, out_priv 32. Returns 0 ok; -1 keygen, -2 pubkey, -3 inputs, -4 build. h2tl_write_pem(cert_der: *u8, der_len: i64, path_z: *u8) -> i64 write the DER as a PEM file an external curl can trust via --cacert (BEGIN/END CERTIFICATE armor + base64 re-wrapped at 64 cols, composing the canonical nx_base64 b64_encode -- nx_pem.nx only DECODES). Returns 0 ok, <0 on open/write failure. COMPOSES (each imported once): nx_csprng (csprng_fill), nx_ed25519_signature (ed25519_pub_from_priv), hub/nx_x509_build + nx_x509 + nx_x509_trust_store (self-signed leaf builder), nx_base64 (b64_encode), nx_syscalls (mmap/file I/O + nx_str_cpy + sys_now_realtime_sec). license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_5280 + rfc_4648 + rfc_8032 lineage_id: nishi_h2_test_leaf_b1r6

dependencies 8 imports · 1 importers

nx_syscalls.nx nx_str.nx nx_csprng.nx nx_ed25519_signature.nx nx_x509_build.nx nx_x509.nx nx_x509_trust_store.nx nx_base64.nx nx_h2_test_leaf.nx _h2_multistream_interop_gate.nx

imports: nx_syscalls.nxnx_str.nxnx_csprng.nxnx_ed25519_signature.nxnx_x509_build.nxnx_x509.nxnx_x509_trust_store.nxnx_base64.nx

imported by: _h2_multistream_interop_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_write sys_mmap h2tl_make_cert nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd sys_read sys_close sys_mmap ↻ ed25519_pub_from_priv sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 sha512_gamma1 sha512_sigma1 sha512_ch sha512_k sha512_sigma0 sha512_maj sha512_final sha512_blk_set_byte ↻ sha512_compress ↻ ge_p3_alloc sys_mmap ↻ fe_alloc nx_scratch nx_scratch_init nx_scratch_oom sys_mmap ↻

structs

none

consts

41const K_MAGIC_719468: i64 = 719468
42const K_MAGIC_146097: i64 = 146097
43const K_MAGIC_146096: i64 = 146096
44const K_MAGIC_1460: i64 = 1460
45const K_MAGIC_36524: i64 = 36524
46const K_MAGIC_86400: i64 = 86400
47const K_MAGIC_3600: i64 = 3600
48const K_MAGIC_8192: i64 = 8192

functions

51func h2tl_civil_from_days(days: i64, out_y: *i64, out_m: *i64, out_d: *i64) -> i64
67func h2tl_format_generalized_time(unix_sec: i64, out_15: *u8) -> i64
97func h2tl_make_cert(out_cert_der: *u8, out_cert_len: *i64, out_priv: *u8) -> i64
122func h2tl_write_pem(cert_der: *u8, der_len: i64, path_z: *u8) -> i64
146func main() -> i64