aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / omega / allen / tests / tls-session-schedule.om
| 1 | note RFC8448 section3 independent published SHA256 schedule values. |
| 2 | note Concatenate production crypto, cert, tls modules then this fixture. No replacement APIs. |
| 3 | note RFC trace suite1301 uses the same SHA256 schedule; only its 12-byte IV is checked here. |
| 4 | text Vhs "1dc826e93606aa6fdc0aadc12f741b01046aa6b99f691ed221a9f0ca043fbeac" |
| 5 | text Vhash "860c06edc07858ee8e78f0e7428c58edd6b43f2ca3e6e95f02ed063cf0e1cad8" |
| 6 | text Vchs "b3eddb126e067f35a780b3abf45e2d8f3b1a950738f52e9600746a0e27a55a21" |
| 7 | text Vshs "b67b7d690cc16c4e75e54213cb2d37b4e9c912bcded9105d42befd59d391ad38" |
| 8 | text Vder "43de77e0c77713859a944db9db2590b53190a65b3ee2e4f12dd7a0bb7ce254b4" |
| 9 | text Vmaster "18df06843d13a08bf2a449844c5f8a478001bc4d4c627984d5a41da8d0402919" |
| 10 | text Vfkey "008d3b66f816ea559f96b537e885c31fc068bf492c652f01f288a1d8cdc19fc8" |
| 11 | text Vempty "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" |
| 12 | text Viv "5d313eb2671276ee13000b30" |
| 13 | fn vhex c uchar to uchar |
| 14 | if le c 57 |
| 15 | ret sub c 48 |
| 16 | end |
| 17 | ret add sub c 97 10 |
| 18 | end |
| 19 | fn main to int |
| 20 | tsclear |
| 21 | for i ulong 32 |
| 22 | p = mul i 2 |
| 23 | put Tssec i or shl vhex get Vhs p 4 vhex get Vhs add p 1 |
| 24 | put Tshash i or shl vhex get Vhash p 4 vhex get Vhash add p 1 |
| 25 | end |
| 26 | if not tsexpand 1 0 true 32 |
| 27 | ret 1 |
| 28 | end |
| 29 | for i ulong 32 |
| 30 | p = mul i 2 |
| 31 | b = or shl vhex get Vchs p 4 vhex get Vchs add p 1 |
| 32 | if ne get Tcdigest i b |
| 33 | ret 2 |
| 34 | end |
| 35 | end |
| 36 | if not tsexpand 2 0 true 32 |
| 37 | ret 3 |
| 38 | end |
| 39 | for i ulong 32 |
| 40 | p = mul i 2 |
| 41 | b = or shl vhex get Vshs p 4 vhex get Vshs add p 1 |
| 42 | if ne get Tcdigest i b |
| 43 | ret 4 |
| 44 | end |
| 45 | put Tssec add i 64 b |
| 46 | end |
| 47 | if not tsexpand 6 64 false 12 |
| 48 | ret 5 |
| 49 | end |
| 50 | for i ulong 12 |
| 51 | p = mul i 2 |
| 52 | b = or shl vhex get Viv p 4 vhex get Viv add p 1 |
| 53 | if ne get Tcdigest i b |
| 54 | ret 6 |
| 55 | end |
| 56 | end |
| 57 | if not tsexpand 7 64 false 32 |
| 58 | ret 7 |
| 59 | end |
| 60 | for i ulong 32 |
| 61 | p = mul i 2 |
| 62 | b = or shl vhex get Vfkey p 4 vhex get Vfkey add p 1 |
| 63 | if ne get Tcdigest i b |
| 64 | ret 8 |
| 65 | end |
| 66 | end |
| 67 | if not tsempty |
| 68 | ret 9 |
| 69 | end |
| 70 | for i ulong 32 |
| 71 | p = mul i 2 |
| 72 | b = or shl vhex get Vempty p 4 vhex get Vempty add p 1 |
| 73 | if ne get Tshash i b |
| 74 | ret 10 |
| 75 | end |
| 76 | end |
| 77 | if not tsexpand 0 0 true 32 |
| 78 | ret 11 |
| 79 | end |
| 80 | for i ulong 32 |
| 81 | p = mul i 2 |
| 82 | b = or shl vhex get Vder p 4 vhex get Vder add p 1 |
| 83 | if ne get Tcdigest i b |
| 84 | ret 12 |
| 85 | end |
| 86 | put Tckey i get Tcdigest i |
| 87 | put Tcbuf i 0 |
| 88 | end |
| 89 | if not tchmac 32 32 |
| 90 | ret 13 |
| 91 | end |
| 92 | for i ulong 32 |
| 93 | p = mul i 2 |
| 94 | b = or shl vhex get Vmaster p 4 vhex get Vmaster add p 1 |
| 95 | if ne get Tcdigest i b |
| 96 | ret 14 |
| 97 | end |
| 98 | end |
| 99 | note RFC8446 section5.3 sequence is big endian, left-padded to IV length, XOR. |
| 100 | for i ulong 12 |
| 101 | put Tsiv i uchar i |
| 102 | end |
| 103 | tsnonce 0 0 72623859790382856 |
| 104 | for i ulong 4 |
| 105 | if ne get Tciv i uchar i |
| 106 | ret 15 |
| 107 | end |
| 108 | end |
| 109 | for i ulong 8 |
| 110 | b = xor uchar add i 4 uchar add i 1 |
| 111 | if ne get Tciv add i 4 b |
| 112 | ret 16 |
| 113 | end |
| 114 | end |
| 115 | if tsexpand 5 0 false 33 |
| 116 | ret 17 |
| 117 | end |
| 118 | if tsexpand 5 0 false 0 |
| 119 | ret 18 |
| 120 | end |
| 121 | tswipe |
| 122 | for i ulong 192 |
| 123 | if ne get Tssec i 0 |
| 124 | ret 19 |
| 125 | end |
| 126 | end |
| 127 | ret 0 |
| 128 | end |