Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/protocol/uor-gpu/ed_sign.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / protocol / uor-gpu / ed_sign.om` 144 lines ยท 3955 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note protocol/uor-gpu/ed_sign.om: Pure seeded OM-2 RFC 8032 section 5.1.5/5.1.6 Ed25519 key 3 note derivation and signing for the UOR-GPU-1 producer side (bundle and grant signing). Reuses the 4 note field, point and scalar code of protocol/omnet/om/`ed25519`/`ed25519`.om and the SHA-512 of 5 note protocol/omnet/om/sha512/sha512.om. Variable time, NOT constant-time-audited: run it only on a 6 note host that owns the seed. The verifier path (verify.om, gate.om) never calls it. 7 note Compose after protocol/uor-gpu/emit_kernels.om. 8 9 note o = x64[0..64) mod L as 32 little-endian bytes 10 fn ues_red x64 view uchar 64 o edit uchar 32 to void 11 x = new long 64 0 12 for i ulong 64 13 put x i long get x64 i 14 end 15 edmodl x 16 for i ulong 32 17 put o i uchar get x i 18 end 19 end 20 21 note RFC 8032 5.1.5: h = SHA-512(seed); ar = clamp(h[0..32)) mod L; pfx[0..32) = h[32..64). 22 note Reducing the clamped scalar mod L leaves [a]B unchanged (B has order L) and keeps it below L 23 note as edsmul requires. 24 fn ues_expand seed view uchar 32 ar edit uchar 32 pfx edit uchar 64 to void 25 m = new uchar 65536 0 26 hd = new uchar 64 0 27 t = new uchar 64 0 28 for i ulong 32 29 put m i get seed i 30 end 31 s512hash m 32 hd 32 for i ulong 32 33 put t i get hd i 34 put pfx i get hd add i 32 35 end 36 put t 0 and get t 0 uchar 248 37 put t 31 and get t 31 uchar 127 38 put t 31 or get t 31 uchar 64 39 ues_red t ar 40 end 41 42 note o = encode([s]B) for a scalar s below L (edsmul with k = 0) 43 fn ues_basemul s view uchar 32 o edit uchar 32 to void 44 w = new ulong 1024 0 45 z = new uchar 32 0 46 edinit w 47 edsmul w s z 48 edpenc w edq o 49 end 50 51 note pk = public key A of the 32-byte seed 52 fn ues_pubkey seed view uchar 32 pk edit uchar 32 to void 53 ar = new uchar 32 0 54 pfx = new uchar 64 0 55 ues_expand seed ar pfx 56 ues_basemul ar pk 57 end 58 59 note sg[32..64) = (r + k * a) mod L (TweetNaCl schoolbook product, then edmodl) 60 fn ues_muladd r view uchar 32 k view uchar 32 a view uchar 32 sg edit uchar 64 to void 61 x = new long 64 0 62 for i ulong 32 63 put x i long get r i 64 end 65 for i ulong 32 66 ki = long get k i 67 for j ulong 32 68 p = add i j 69 put x p add get x p mul ki long get a j 70 end 71 end 72 edmodl x 73 for i ulong 32 74 put sg add 32 i uchar get x i 75 end 76 end 77 78 note hd = SHA-512(pfx[0..32) || m[0..n)), n <= 65504 (else trap 3) 79 fn ues_hprefix pfx view uchar 64 m view uchar 65536 n ulong hd edit uchar 64 to void 80 if gt n 65504 81 trap 3 82 end 83 pm = new uchar 65536 0 84 for i ulong 32 85 put pm i get pfx i 86 end 87 for i ulong n bound 65504 88 put pm add 32 i get m i 89 end 90 s512hash pm add n 32 hd 91 end 92 93 note RFC 8032 5.1.6: sg = R || S, the Ed25519 signature of m[0..n) under the 32-byte seed 94 fn ues_sign seed view uchar 32 m view uchar 65536 n ulong sg edit uchar 64 to void 95 ar = new uchar 32 0 96 pfx = new uchar 64 0 97 pk = new uchar 32 0 98 hd = new uchar 64 0 99 r = new uchar 32 0 100 rb = new uchar 32 0 101 k = new uchar 32 0 102 ues_expand seed ar pfx 103 ues_basemul ar pk 104 ues_hprefix pfx m n hd 105 ues_red hd r 106 ues_basemul r rb 107 for i ulong 32 108 put sg i get rb i 109 end 110 edhram sg pk m n k 111 ues_muladd r k ar sg 112 end 113 114 note Sign a sealed UOR-GPU-1 header: hdr[288..320) = public key of seed, 115 note hdr[320..384) = Ed25519(seed, hdr[224..288)) over uor_id_sha256 || holo_blake3. 116 fn ues_sign_hdr hdr edit uchar 384 seed view uchar 32 to void 117 pk = new uchar 32 0 118 m = new uchar 65536 0 119 sg = new uchar 64 0 120 ues_pubkey seed pk 121 for i ulong 64 122 put m i get hdr add 224 i 123 end 124 ues_sign seed m 64 sg 125 for i ulong 32 126 put hdr add 288 i get pk i 127 end 128 for i ulong 64 129 put hdr add 320 i get sg i 130 end 131 end 132 133 note Sign a 64-byte capability grant record: g[64..128) = Ed25519(seed, g[0..64)) 134 fn ues_sign_grant g edit uchar 168 seed view uchar 32 to void 135 m = new uchar 65536 0 136 sg = new uchar 64 0 137 for i ulong 64 138 put m i get g i 139 end 140 ues_sign seed m 64 sg 141 for i ulong 64 142 put g add 64 i get sg i 143 end 144 end