omtls
omtls: a TLS 1.3 client (RFC 8446) written fresh in seeded Omega, for mailhand. Not audited by a cryptographer. Free (Apache-2.0).
Brought by drakestapleton
omtls / tests / drv / symbench.om
| 1 | note omtls benchmark (not a test driver): ot_ae_seal throughput over 1 MiB for ChaCha20-Poly1305 (alg 3) and |
| 2 | note AES-128-GCM (alg 1), and X25519 (ot_x25_mul) operations per second. Wall time from monons. |
| 3 | note Output: one line per figure, "bench NAME bytes_or_ops=N reps=R ns=T per_second=P". |
| 4 | text ot_syb_b "bench " |
| 5 | text ot_syb_n " n=" |
| 6 | text ot_syb_r " reps=" |
| 7 | text ot_syb_t " ns=" |
| 8 | text ot_syb_p " per_second=" |
| 9 | text ot_syb_cp "chacha20-poly1305-seal-bytes" |
| 10 | text ot_syb_gc "aes-128-gcm-seal-bytes" |
| 11 | text ot_syb_x "x25519-ops" |
| 12 | text ot_syb_nl "\n" |
| 13 | fn ot_syb_out nm view uchar * n ulong reps ulong ns ulong to void |
| 14 | ot_sy_put ot_syb_b |
| 15 | ot_sy_put nm |
| 16 | ot_sy_put ot_syb_n |
| 17 | ot_sy_num n |
| 18 | ot_sy_put ot_syb_r |
| 19 | ot_sy_num reps |
| 20 | ot_sy_put ot_syb_t |
| 21 | ot_sy_num ns |
| 22 | ot_sy_put ot_syb_p |
| 23 | ot_sy_num div mul mul n reps 1000 div ns 1000000 |
| 24 | ot_sy_put ot_syb_nl |
| 25 | end |
| 26 | fn ot_syb_ae alg ulong buf edit uchar * reps ulong to ulong |
| 27 | kn = new uchar 44 7 |
| 28 | aad = new uchar 13 1 |
| 29 | t0 = monons |
| 30 | j = ulong 0 |
| 31 | while lt j reps bound 1000000 |
| 32 | ot_ae_seal alg kn aad buf |
| 33 | j = add j 1 |
| 34 | end |
| 35 | ret ulong sub monons t0 |
| 36 | end |
| 37 | fn main to int |
| 38 | buf = new uchar 1048592 5 |
| 39 | ns = ot_syb_ae 3 buf 16 |
| 40 | ot_syb_out ot_syb_cp 1048576 16 ns |
| 41 | ns = ot_syb_ae 1 buf 4 |
| 42 | ot_syb_out ot_syb_gc 1048576 4 ns |
| 43 | o = new uchar 32 0 |
| 44 | k = new uchar 32 3 |
| 45 | u = new uchar 32 9 |
| 46 | t0 = monons |
| 47 | j = ulong 0 |
| 48 | while lt j 2000 bound 2001 |
| 49 | ot_x25_mul o k u |
| 50 | j = add j 1 |
| 51 | end |
| 52 | ns = ulong sub monons t0 |
| 53 | ot_syb_out ot_syb_x 1 2000 ns |
| 54 | ret 0 |
| 55 | end |