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
omega-mv / om / tls / test / fuzz / fz_pem.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note fz_pem.om: fuzz target for the PEM trust-store loader of om/tls/x509.om (pem_decode: armour |
| 3 | note scanning, base64, per-certificate parsing into store entries) and for chain verification against |
| 4 | note the store it builds. Input: a PEM bundle (as /etc/ssl/certs/ca-certificates.crt would hold). |
| 5 | note Argument 1 (optional): a certificate_list file (3-byte length, DER, 2-byte zero, per entry, as |
| 6 | note run.sh writes from om/tls/test/x509/vectors/pki/lR.der + intR.der) checked against the store |
| 7 | note when pem_decode accepted it, at now 1792972800 and host www.example.test. |
| 8 | |
| 9 | fn fz_pchain st view uchar * to ulong |
| 10 | cl = new uchar 16384 0 |
| 11 | hq = new uchar 32 0 |
| 12 | m = fz_load 1 cl |
| 13 | if eq m 0 |
| 14 | ret 0 |
| 15 | end |
| 16 | h = fz_hq hq |
| 17 | ret x509_chain_verify part cl 0 m st part hq 0 h |
| 18 | end |
| 19 | |
| 20 | fn main to int |
| 21 | st = new uchar TLSTSZ 0 |
| 22 | n = fz_read st |
| 23 | if lt n 1 |
| 24 | ret 0 |
| 25 | end |
| 26 | r = pem_decode st n |
| 27 | if gt r 0 |
| 28 | v = fz_pchain view st |
| 29 | end |
| 30 | ret 0 |
| 31 | end |