iPXE
tlskey_test.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25
26/** @file
27 *
28 * TLS key schedule tests
29 *
30 * TLS version 1.3 example handshake traces are provided in RFC 8448.
31 * We include the "Simple 1-RTT Handshake" and "Resumed 0-RTT
32 * Handshake" test cases, to exercise all successful code paths for
33 * the HKDF-based key schedule (including session resumption).
34 *
35 * For TLS version 1.2 and earlier, there are no good reference
36 * example handshake traces available. We choose to run through a
37 * non-functional minimal handshake that allows us to exercise the
38 * relevant code paths and so at least prevent regressions.
39 *
40 */
41
42/* Forcibly enable assertions */
43#undef NDEBUG
44
45#include <string.h>
46#include <ipxe/malloc.h>
47#include <ipxe/sha256.h>
48#include <ipxe/md5_sha1.h>
49#include <ipxe/x25519.h>
50#include <ipxe/p256.h>
51#include <ipxe/tlskey.h>
52#include <ipxe/test.h>
53
54/** RFC 8448 simple 1-RTT test: client random bytes */
56 .bytes = {
57 0xcb, 0x34, 0xec, 0xb1, 0xe7, 0x81, 0x63, 0xba, 0x1c, 0x38,
58 0xc6, 0xda, 0xcb, 0x19, 0x6a, 0x6d, 0xff, 0xa2, 0x1a, 0x8d,
59 0x99, 0x12, 0xec, 0x18, 0xa2, 0xef, 0x62, 0x83, 0x02, 0x4d,
60 0xec, 0xe7
61 },
62};
63
64/** RFC 8448 simple 1-RTT test: client X25519 private key */
66 0x49, 0xaf, 0x42, 0xba, 0x7f, 0x79, 0x94, 0x85, 0x2d, 0x71, 0x3e,
67 0xf2, 0x78, 0x4b, 0xcb, 0xca, 0xa7, 0x91, 0x1d, 0xe2, 0x6a, 0xdc,
68 0x56, 0x42, 0xcb, 0x63, 0x45, 0x40, 0xe7, 0xea, 0x50, 0x05
69};
70
71/** RFC 8448 simple 1-RTT test: server X25519 public key */
73 0xc9, 0x82, 0x88, 0x76, 0x11, 0x20, 0x95, 0xfe, 0x66, 0x76, 0x2b,
74 0xdb, 0xf7, 0xc6, 0x72, 0xe1, 0x56, 0xd6, 0xcc, 0x25, 0x3b, 0x83,
75 0x3d, 0xf1, 0xdd, 0x69, 0xb1, 0xb0, 0x4e, 0x75, 0x1f, 0x0f
76};
77
78/** RFC 8448 simple 1-RTT test: ticket nonce */
79static const uint8_t rfc8448_simple_ticket_nonce[] = { 0x00, 0x00 };
80
81/** RFC 8448 simple 1-RTT test: ClientHello */
83 0x01, 0x00, 0x00, 0xc0, 0x03, 0x03, 0xcb, 0x34, 0xec, 0xb1, 0xe7,
84 0x81, 0x63, 0xba, 0x1c, 0x38, 0xc6, 0xda, 0xcb, 0x19, 0x6a, 0x6d,
85 0xff, 0xa2, 0x1a, 0x8d, 0x99, 0x12, 0xec, 0x18, 0xa2, 0xef, 0x62,
86 0x83, 0x02, 0x4d, 0xec, 0xe7, 0x00, 0x00, 0x06, 0x13, 0x01, 0x13,
87 0x03, 0x13, 0x02, 0x01, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x0b,
88 0x00, 0x09, 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
89 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x12,
90 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x01, 0x00, 0x01,
91 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x23, 0x00, 0x00,
92 0x00, 0x33, 0x00, 0x26, 0x00, 0x24, 0x00, 0x1d, 0x00, 0x20, 0x99,
93 0x38, 0x1d, 0xe5, 0x60, 0xe4, 0xbd, 0x43, 0xd2, 0x3d, 0x8e, 0x43,
94 0x5a, 0x7d, 0xba, 0xfe, 0xb3, 0xc0, 0x6e, 0x51, 0xc1, 0x3c, 0xae,
95 0x4d, 0x54, 0x13, 0x69, 0x1e, 0x52, 0x9a, 0xaf, 0x2c, 0x00, 0x2b,
96 0x00, 0x03, 0x02, 0x03, 0x04, 0x00, 0x0d, 0x00, 0x20, 0x00, 0x1e,
97 0x04, 0x03, 0x05, 0x03, 0x06, 0x03, 0x02, 0x03, 0x08, 0x04, 0x08,
98 0x05, 0x08, 0x06, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x02, 0x01,
99 0x04, 0x02, 0x05, 0x02, 0x06, 0x02, 0x02, 0x02, 0x00, 0x2d, 0x00,
100 0x02, 0x01, 0x01, 0x00, 0x1c, 0x00, 0x02, 0x40, 0x01
101};
102
103/** RFC 8448 simple 1-RTT test: ServerHello */
105 0x02, 0x00, 0x00, 0x56, 0x03, 0x03, 0xa6, 0xaf, 0x06, 0xa4, 0x12,
106 0x18, 0x60, 0xdc, 0x5e, 0x6e, 0x60, 0x24, 0x9c, 0xd3, 0x4c, 0x95,
107 0x93, 0x0c, 0x8a, 0xc5, 0xcb, 0x14, 0x34, 0xda, 0xc1, 0x55, 0x77,
108 0x2e, 0xd3, 0xe2, 0x69, 0x28, 0x00, 0x13, 0x01, 0x00, 0x00, 0x2e,
109 0x00, 0x33, 0x00, 0x24, 0x00, 0x1d, 0x00, 0x20, 0xc9, 0x82, 0x88,
110 0x76, 0x11, 0x20, 0x95, 0xfe, 0x66, 0x76, 0x2b, 0xdb, 0xf7, 0xc6,
111 0x72, 0xe1, 0x56, 0xd6, 0xcc, 0x25, 0x3b, 0x83, 0x3d, 0xf1, 0xdd,
112 0x69, 0xb1, 0xb0, 0x4e, 0x75, 0x1f, 0x0f, 0x00, 0x2b, 0x00, 0x02,
113 0x03, 0x04
114};
115
116/** RFC 8448 simple 1-RTT test: EncryptedExtensions */
118 0x08, 0x00, 0x00, 0x24, 0x00, 0x22, 0x00, 0x0a, 0x00, 0x14, 0x00,
119 0x12, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x01, 0x00,
120 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x1c, 0x00,
121 0x02, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00
122};
123
124/** RFC 8448 simple 1-RTT test: Certificate */
126 0x0b, 0x00, 0x01, 0xb9, 0x00, 0x00, 0x01, 0xb5, 0x00, 0x01, 0xb0,
127 0x30, 0x82, 0x01, 0xac, 0x30, 0x82, 0x01, 0x15, 0xa0, 0x03, 0x02,
128 0x01, 0x02, 0x02, 0x01, 0x02, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
129 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x0e,
130 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x03,
131 0x72, 0x73, 0x61, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x36, 0x30, 0x37,
132 0x33, 0x30, 0x30, 0x31, 0x32, 0x33, 0x35, 0x39, 0x5a, 0x17, 0x0d,
133 0x32, 0x36, 0x30, 0x37, 0x33, 0x30, 0x30, 0x31, 0x32, 0x33, 0x35,
134 0x39, 0x5a, 0x30, 0x0e, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55,
135 0x04, 0x03, 0x13, 0x03, 0x72, 0x73, 0x61, 0x30, 0x81, 0x9f, 0x30,
136 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
137 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02,
138 0x81, 0x81, 0x00, 0xb4, 0xbb, 0x49, 0x8f, 0x82, 0x79, 0x30, 0x3d,
139 0x98, 0x08, 0x36, 0x39, 0x9b, 0x36, 0xc6, 0x98, 0x8c, 0x0c, 0x68,
140 0xde, 0x55, 0xe1, 0xbd, 0xb8, 0x26, 0xd3, 0x90, 0x1a, 0x24, 0x61,
141 0xea, 0xfd, 0x2d, 0xe4, 0x9a, 0x91, 0xd0, 0x15, 0xab, 0xbc, 0x9a,
142 0x95, 0x13, 0x7a, 0xce, 0x6c, 0x1a, 0xf1, 0x9e, 0xaa, 0x6a, 0xf9,
143 0x8c, 0x7c, 0xed, 0x43, 0x12, 0x09, 0x98, 0xe1, 0x87, 0xa8, 0x0e,
144 0xe0, 0xcc, 0xb0, 0x52, 0x4b, 0x1b, 0x01, 0x8c, 0x3e, 0x0b, 0x63,
145 0x26, 0x4d, 0x44, 0x9a, 0x6d, 0x38, 0xe2, 0x2a, 0x5f, 0xda, 0x43,
146 0x08, 0x46, 0x74, 0x80, 0x30, 0x53, 0x0e, 0xf0, 0x46, 0x1c, 0x8c,
147 0xa9, 0xd9, 0xef, 0xbf, 0xae, 0x8e, 0xa6, 0xd1, 0xd0, 0x3e, 0x2b,
148 0xd1, 0x93, 0xef, 0xf0, 0xab, 0x9a, 0x80, 0x02, 0xc4, 0x74, 0x28,
149 0xa6, 0xd3, 0x5a, 0x8d, 0x88, 0xd7, 0x9f, 0x7f, 0x1e, 0x3f, 0x02,
150 0x03, 0x01, 0x00, 0x01, 0xa3, 0x1a, 0x30, 0x18, 0x30, 0x09, 0x06,
151 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0b, 0x06,
152 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30,
153 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
154 0x0b, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x85, 0xaa, 0xd2, 0xa0,
155 0xe5, 0xb9, 0x27, 0x6b, 0x90, 0x8c, 0x65, 0xf7, 0x3a, 0x72, 0x67,
156 0x17, 0x06, 0x18, 0xa5, 0x4c, 0x5f, 0x8a, 0x7b, 0x33, 0x7d, 0x2d,
157 0xf7, 0xa5, 0x94, 0x36, 0x54, 0x17, 0xf2, 0xea, 0xe8, 0xf8, 0xa5,
158 0x8c, 0x8f, 0x81, 0x72, 0xf9, 0x31, 0x9c, 0xf3, 0x6b, 0x7f, 0xd6,
159 0xc5, 0x5b, 0x80, 0xf2, 0x1a, 0x03, 0x01, 0x51, 0x56, 0x72, 0x60,
160 0x96, 0xfd, 0x33, 0x5e, 0x5e, 0x67, 0xf2, 0xdb, 0xf1, 0x02, 0x70,
161 0x2e, 0x60, 0x8c, 0xca, 0xe6, 0xbe, 0xc1, 0xfc, 0x63, 0xa4, 0x2a,
162 0x99, 0xbe, 0x5c, 0x3e, 0xb7, 0x10, 0x7c, 0x3c, 0x54, 0xe9, 0xb9,
163 0xeb, 0x2b, 0xd5, 0x20, 0x3b, 0x1c, 0x3b, 0x84, 0xe0, 0xa8, 0xb2,
164 0xf7, 0x59, 0x40, 0x9b, 0xa3, 0xea, 0xc9, 0xd9, 0x1d, 0x40, 0x2d,
165 0xcc, 0x0c, 0xc8, 0xf8, 0x96, 0x12, 0x29, 0xac, 0x91, 0x87, 0xb4,
166 0x2b, 0x4d, 0xe1, 0x00, 0x00
167};
168
169/** RFC 8448 simple 1-RTT test: CertificateVerify */
171 0x0f, 0x00, 0x00, 0x84, 0x08, 0x04, 0x00, 0x80, 0x5a, 0x74, 0x7c,
172 0x5d, 0x88, 0xfa, 0x9b, 0xd2, 0xe5, 0x5a, 0xb0, 0x85, 0xa6, 0x10,
173 0x15, 0xb7, 0x21, 0x1f, 0x82, 0x4c, 0xd4, 0x84, 0x14, 0x5a, 0xb3,
174 0xff, 0x52, 0xf1, 0xfd, 0xa8, 0x47, 0x7b, 0x0b, 0x7a, 0xbc, 0x90,
175 0xdb, 0x78, 0xe2, 0xd3, 0x3a, 0x5c, 0x14, 0x1a, 0x07, 0x86, 0x53,
176 0xfa, 0x6b, 0xef, 0x78, 0x0c, 0x5e, 0xa2, 0x48, 0xee, 0xaa, 0xa7,
177 0x85, 0xc4, 0xf3, 0x94, 0xca, 0xb6, 0xd3, 0x0b, 0xbe, 0x8d, 0x48,
178 0x59, 0xee, 0x51, 0x1f, 0x60, 0x29, 0x57, 0xb1, 0x54, 0x11, 0xac,
179 0x02, 0x76, 0x71, 0x45, 0x9e, 0x46, 0x44, 0x5c, 0x9e, 0xa5, 0x8c,
180 0x18, 0x1e, 0x81, 0x8e, 0x95, 0xb8, 0xc3, 0xfb, 0x0b, 0xf3, 0x27,
181 0x84, 0x09, 0xd3, 0xbe, 0x15, 0x2a, 0x3d, 0xa5, 0x04, 0x3e, 0x06,
182 0x3d, 0xda, 0x65, 0xcd, 0xf5, 0xae, 0xa2, 0x0d, 0x53, 0xdf, 0xac,
183 0xd4, 0x2f, 0x74, 0xf3
184};
185
186/** RFC 8448 simple 1-RTT test: server Finished */
188 0x14, 0x00, 0x00, 0x20, 0x9b, 0x9b, 0x14, 0x1d, 0x90, 0x63, 0x37,
189 0xfb, 0xd2, 0xcb, 0xdc, 0xe7, 0x1d, 0xf4, 0xde, 0xda, 0x4a, 0xb4,
190 0x2c, 0x30, 0x95, 0x72, 0xcb, 0x7f, 0xff, 0xee, 0x54, 0x54, 0xb7,
191 0x8f, 0x07, 0x18
192};
193
194/** RFC 8448 simple 1-RTT test: client Finished */
196 0x14, 0x00, 0x00, 0x20, 0xa8, 0xec, 0x43, 0x6d, 0x67, 0x76, 0x34,
197 0xae, 0x52, 0x5a, 0xc1, 0xfc, 0xeb, 0xe1, 0x1a, 0x03, 0x9e, 0xc1,
198 0x76, 0x94, 0xfa, 0xc6, 0xe9, 0x85, 0x27, 0xb6, 0x42, 0xf2, 0xed,
199 0xd5, 0xce, 0x61
200};
201
202/** RFC 8448 simple 1-RTT test: NewSessionTicket */
204 0x04, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x1e, 0xfa, 0xd6, 0xaa,
205 0xc5, 0x02, 0x00, 0x00, 0x00, 0xb2, 0x2c, 0x03, 0x5d, 0x82, 0x93,
206 0x59, 0xee, 0x5f, 0xf7, 0xaf, 0x4e, 0xc9, 0x00, 0x00, 0x00, 0x00,
207 0x26, 0x2a, 0x64, 0x94, 0xdc, 0x48, 0x6d, 0x2c, 0x8a, 0x34, 0xcb,
208 0x33, 0xfa, 0x90, 0xbf, 0x1b, 0x00, 0x70, 0xad, 0x3c, 0x49, 0x88,
209 0x83, 0xc9, 0x36, 0x7c, 0x09, 0xa2, 0xbe, 0x78, 0x5a, 0xbc, 0x55,
210 0xcd, 0x22, 0x60, 0x97, 0xa3, 0xa9, 0x82, 0x11, 0x72, 0x83, 0xf8,
211 0x2a, 0x03, 0xa1, 0x43, 0xef, 0xd3, 0xff, 0x5d, 0xd3, 0x6d, 0x64,
212 0xe8, 0x61, 0xbe, 0x7f, 0xd6, 0x1d, 0x28, 0x27, 0xdb, 0x27, 0x9c,
213 0xce, 0x14, 0x50, 0x77, 0xd4, 0x54, 0xa3, 0x66, 0x4d, 0x4e, 0x6d,
214 0xa4, 0xd2, 0x9e, 0xe0, 0x37, 0x25, 0xa6, 0xa4, 0xda, 0xfc, 0xd0,
215 0xfc, 0x67, 0xd2, 0xae, 0xa7, 0x05, 0x29, 0x51, 0x3e, 0x3d, 0xa2,
216 0x67, 0x7f, 0xa5, 0x90, 0x6c, 0x5b, 0x3f, 0x7d, 0x8f, 0x92, 0xf2,
217 0x28, 0xbd, 0xa4, 0x0d, 0xda, 0x72, 0x14, 0x70, 0xf9, 0xfb, 0xf2,
218 0x97, 0xb5, 0xae, 0xa6, 0x17, 0x64, 0x6f, 0xac, 0x5c, 0x03, 0x27,
219 0x2e, 0x97, 0x07, 0x27, 0xc6, 0x21, 0xa7, 0x91, 0x41, 0xef, 0x5f,
220 0x7d, 0xe6, 0x50, 0x5e, 0x5b, 0xfb, 0xc3, 0x88, 0xe9, 0x33, 0x43,
221 0x69, 0x40, 0x93, 0x93, 0x4a, 0xe4, 0xd3, 0x57, 0x00, 0x08, 0x00,
222 0x2a, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00
223};
224
225/** RFC 8448 simple 1-RTT test: early secret */
227 0x33, 0xad, 0x0a, 0x1c, 0x60, 0x7e, 0xc0, 0x3b, 0x09, 0xe6, 0xcd,
228 0x98, 0x93, 0x68, 0x0c, 0xe2, 0x10, 0xad, 0xf3, 0x00, 0xaa, 0x1f,
229 0x26, 0x60, 0xe1, 0xb2, 0x2e, 0x10, 0xf1, 0x70, 0xf9, 0x2a
230};
231
232/** RFC 8448 simple 1-RTT test: handshake secret */
234 0x1d, 0xc8, 0x26, 0xe9, 0x36, 0x06, 0xaa, 0x6f, 0xdc, 0x0a, 0xad,
235 0xc1, 0x2f, 0x74, 0x1b, 0x01, 0x04, 0x6a, 0xa6, 0xb9, 0x9f, 0x69,
236 0x1e, 0xd2, 0x21, 0xa9, 0xf0, 0xca, 0x04, 0x3f, 0xbe, 0xac
237};
238
239/** RFC 8448 simple 1-RTT test: client handshake traffic secret */
241 0xb3, 0xed, 0xdb, 0x12, 0x6e, 0x06, 0x7f, 0x35, 0xa7, 0x80, 0xb3,
242 0xab, 0xf4, 0x5e, 0x2d, 0x8f, 0x3b, 0x1a, 0x95, 0x07, 0x38, 0xf5,
243 0x2e, 0x96, 0x00, 0x74, 0x6a, 0x0e, 0x27, 0xa5, 0x5a, 0x21
244};
245
246/** RFC 8448 simple 1-RTT test: client handshake traffic key */
248 0xdb, 0xfa, 0xa6, 0x93, 0xd1, 0x76, 0x2c, 0x5b, 0x66, 0x6a, 0xf5,
249 0xd9, 0x50, 0x25, 0x8d, 0x01
250};
251
252/** RFC 8448 simple 1-RTT test: client handshake traffic IV */
254 0x5b, 0xd3, 0xc7, 0x1b, 0x83, 0x6e, 0x0b, 0x76, 0xbb, 0x73, 0x26,
255 0x5f
256};
257
258/** RFC 8448 simple 1-RTT test: server handshake traffic secret */
260 0xb6, 0x7b, 0x7d, 0x69, 0x0c, 0xc1, 0x6c, 0x4e, 0x75, 0xe5, 0x42,
261 0x13, 0xcb, 0x2d, 0x37, 0xb4, 0xe9, 0xc9, 0x12, 0xbc, 0xde, 0xd9,
262 0x10, 0x5d, 0x42, 0xbe, 0xfd, 0x59, 0xd3, 0x91, 0xad, 0x38
263};
264
265/** RFC 8448 simple 1-RTT test: server handshake traffic key */
267 0x3f, 0xce, 0x51, 0x60, 0x09, 0xc2, 0x17, 0x27, 0xd0, 0xf2, 0xe4,
268 0xe8, 0x6e, 0xe4, 0x03, 0xbc
269};
270
271/** RFC 8448 simple 1-RTT test: server handshake traffic IV */
273 0x5d, 0x31, 0x3e, 0xb2, 0x67, 0x12, 0x76, 0xee, 0x13, 0x00, 0x0b,
274 0x30
275};
276
277/** RFC 8448 simple 1-RTT test: client verification */
279 0xa8, 0xec, 0x43, 0x6d, 0x67, 0x76, 0x34, 0xae, 0x52, 0x5a, 0xc1,
280 0xfc, 0xeb, 0xe1, 0x1a, 0x03, 0x9e, 0xc1, 0x76, 0x94, 0xfa, 0xc6,
281 0xe9, 0x85, 0x27, 0xb6, 0x42, 0xf2, 0xed, 0xd5, 0xce, 0x61
282};
283
284/** RFC 8448 simple 1-RTT test: server verification */
286 0x9b, 0x9b, 0x14, 0x1d, 0x90, 0x63, 0x37, 0xfb, 0xd2, 0xcb, 0xdc,
287 0xe7, 0x1d, 0xf4, 0xde, 0xda, 0x4a, 0xb4, 0x2c, 0x30, 0x95, 0x72,
288 0xcb, 0x7f, 0xff, 0xee, 0x54, 0x54, 0xb7, 0x8f, 0x07, 0x18
289};
290
291/** RFC 8448 simple 1-RTT test: master secret */
293 0x18, 0xdf, 0x06, 0x84, 0x3d, 0x13, 0xa0, 0x8b, 0xf2, 0xa4, 0x49,
294 0x84, 0x4c, 0x5f, 0x8a, 0x47, 0x80, 0x01, 0xbc, 0x4d, 0x4c, 0x62,
295 0x79, 0x84, 0xd5, 0xa4, 0x1d, 0xa8, 0xd0, 0x40, 0x29, 0x19
296};
297
298/** RFC 8448 simple 1-RTT test: client application traffic secret */
300 0x9e, 0x40, 0x64, 0x6c, 0xe7, 0x9a, 0x7f, 0x9d, 0xc0, 0x5a, 0xf8,
301 0x88, 0x9b, 0xce, 0x65, 0x52, 0x87, 0x5a, 0xfa, 0x0b, 0x06, 0xdf,
302 0x00, 0x87, 0xf7, 0x92, 0xeb, 0xb7, 0xc1, 0x75, 0x04, 0xa5
303};
304
305/** RFC 8448 simple 1-RTT test: client application traffic key */
307 0x17, 0x42, 0x2d, 0xda, 0x59, 0x6e, 0xd5, 0xd9, 0xac, 0xd8, 0x90,
308 0xe3, 0xc6, 0x3f, 0x50, 0x51
309};
310
311/** RFC 8448 simple 1-RTT test: client application traffic IV */
313 0x5b, 0x78, 0x92, 0x3d, 0xee, 0x08, 0x57, 0x90, 0x33, 0xe5, 0x23,
314 0xd9
315};
316
317/** RFC 8448 simple 1-RTT test: server application traffic secret */
319 0xa1, 0x1a, 0xf9, 0xf0, 0x55, 0x31, 0xf8, 0x56, 0xad, 0x47, 0x11,
320 0x6b, 0x45, 0xa9, 0x50, 0x32, 0x82, 0x04, 0xb4, 0xf4, 0x4b, 0xfb,
321 0x6b, 0x3a, 0x4b, 0x4f, 0x1f, 0x3f, 0xcb, 0x63, 0x16, 0x43
322};
323
324/** RFC 8448 simple 1-RTT test: server application traffic key */
326 0x9f, 0x02, 0x28, 0x3b, 0x6c, 0x9c, 0x07, 0xef, 0xc2, 0x6b, 0xb9,
327 0xf2, 0xac, 0x92, 0xe3, 0x56
328};
329
330/** RFC 8448 simple 1-RTT test: server application traffic IV */
332 0xcf, 0x78, 0x2b, 0x88, 0xdd, 0x83, 0x54, 0x9a, 0xad, 0xf1, 0xe9,
333 0x84
334};
335
336/** RFC 8448 simple 1-RTT test: resumption secret */
338 0x4e, 0xcd, 0x0e, 0xb6, 0xec, 0x3b, 0x4d, 0x87, 0xf5, 0xd6, 0x02,
339 0x8f, 0x92, 0x2c, 0xa4, 0xc5, 0x85, 0x1a, 0x27, 0x7f, 0xd4, 0x13,
340 0x11, 0xc9, 0xe6, 0x2d, 0x2c, 0x94, 0x92, 0xe1, 0xc4, 0xf3
341};
342
343/** RFC 8448 simple 1-RTT test: server CertificateVerify signable digest
344 *
345 * This value is not provided directly within RFC 8448, but may be
346 * calculated from the provided values.
347 */
349 0xbe, 0xed, 0x95, 0xaf, 0x40, 0x4e, 0x23, 0xdd, 0x55, 0x3e, 0xbc,
350 0xfb, 0x4a, 0x00, 0xb8, 0xdb, 0xbf, 0x22, 0x44, 0xdb, 0x2a, 0x9a,
351 0xa3, 0x9a, 0x37, 0x92, 0x56, 0x51, 0x26, 0x7c, 0x14, 0x1f
352};
353
354/** RFC 8448 resumed 0-RTT test: server random bytes */
356 .bytes = {
357 0x3c, 0xcf, 0xd2, 0xde, 0xc8, 0x90, 0x22, 0x27, 0x63, 0x47,
358 0x2a, 0xe8, 0x13, 0x67, 0x77, 0xc9, 0xd7, 0x35, 0x87, 0x77,
359 0xbb, 0x66, 0xe9, 0x1e, 0xa5, 0x12, 0x24, 0x95, 0xf5, 0x59,
360 0xea, 0x2d
361 },
362};
363
364/** RFC 8448 resumed 0-RTT test: client X25519 private key */
366 0xbf, 0xf9, 0x11, 0x88, 0x28, 0x38, 0x46, 0xdd, 0x6a, 0x21, 0x34,
367 0xef, 0x71, 0x80, 0xca, 0x2b, 0x0b, 0x14, 0xfb, 0x10, 0xdc, 0xe7,
368 0x07, 0xb5, 0x09, 0x8c, 0x0d, 0xdd, 0xc8, 0x13, 0xb2, 0xdf
369};
370
371/** RFC 8448 resumed 0-RTT test: server X25519 public key */
373 0x12, 0x17, 0x61, 0xee, 0x42, 0xc3, 0x33, 0xe1, 0xb9, 0xe7, 0x7b,
374 0x60, 0xdd, 0x57, 0xc2, 0x05, 0x3c, 0xd9, 0x45, 0x12, 0xab, 0x47,
375 0xf1, 0x15, 0xe8, 0x6e, 0xff, 0x50, 0x94, 0x2c, 0xea, 0x31
376};
377
378/** RFC 8448 resumed 0-RTT test: ClientHello */
380 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03, 0x1b, 0xc3, 0xce, 0xb6, 0xbb,
381 0xe3, 0x9c, 0xff, 0x93, 0x83, 0x55, 0xb5, 0xa5, 0x0a, 0xdb, 0x6d,
382 0xb2, 0x1b, 0x7a, 0x6a, 0xf6, 0x49, 0xd7, 0xb4, 0xbc, 0x41, 0x9d,
383 0x78, 0x76, 0x48, 0x7d, 0x95, 0x00, 0x00, 0x06, 0x13, 0x01, 0x13,
384 0x03, 0x13, 0x02, 0x01, 0x00, 0x01, 0xcd, 0x00, 0x00, 0x00, 0x0b,
385 0x00, 0x09, 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
386 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x12,
387 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x01, 0x00, 0x01,
388 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x33, 0x00, 0x26,
389 0x00, 0x24, 0x00, 0x1d, 0x00, 0x20, 0xe4, 0xff, 0xb6, 0x8a, 0xc0,
390 0x5f, 0x8d, 0x96, 0xc9, 0x9d, 0xa2, 0x66, 0x98, 0x34, 0x6c, 0x6b,
391 0xe1, 0x64, 0x82, 0xba, 0xdd, 0xda, 0xfe, 0x05, 0x1a, 0x66, 0xb4,
392 0xf1, 0x8d, 0x66, 0x8f, 0x0b, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2b,
393 0x00, 0x03, 0x02, 0x03, 0x04, 0x00, 0x0d, 0x00, 0x20, 0x00, 0x1e,
394 0x04, 0x03, 0x05, 0x03, 0x06, 0x03, 0x02, 0x03, 0x08, 0x04, 0x08,
395 0x05, 0x08, 0x06, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x02, 0x01,
396 0x04, 0x02, 0x05, 0x02, 0x06, 0x02, 0x02, 0x02, 0x00, 0x2d, 0x00,
397 0x02, 0x01, 0x01, 0x00, 0x1c, 0x00, 0x02, 0x40, 0x01, 0x00, 0x15,
398 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
406 0x00, 0x00, 0x29, 0x00, 0xdd, 0x00, 0xb8, 0x00, 0xb2, 0x2c, 0x03,
407 0x5d, 0x82, 0x93, 0x59, 0xee, 0x5f, 0xf7, 0xaf, 0x4e, 0xc9, 0x00,
408 0x00, 0x00, 0x00, 0x26, 0x2a, 0x64, 0x94, 0xdc, 0x48, 0x6d, 0x2c,
409 0x8a, 0x34, 0xcb, 0x33, 0xfa, 0x90, 0xbf, 0x1b, 0x00, 0x70, 0xad,
410 0x3c, 0x49, 0x88, 0x83, 0xc9, 0x36, 0x7c, 0x09, 0xa2, 0xbe, 0x78,
411 0x5a, 0xbc, 0x55, 0xcd, 0x22, 0x60, 0x97, 0xa3, 0xa9, 0x82, 0x11,
412 0x72, 0x83, 0xf8, 0x2a, 0x03, 0xa1, 0x43, 0xef, 0xd3, 0xff, 0x5d,
413 0xd3, 0x6d, 0x64, 0xe8, 0x61, 0xbe, 0x7f, 0xd6, 0x1d, 0x28, 0x27,
414 0xdb, 0x27, 0x9c, 0xce, 0x14, 0x50, 0x77, 0xd4, 0x54, 0xa3, 0x66,
415 0x4d, 0x4e, 0x6d, 0xa4, 0xd2, 0x9e, 0xe0, 0x37, 0x25, 0xa6, 0xa4,
416 0xda, 0xfc, 0xd0, 0xfc, 0x67, 0xd2, 0xae, 0xa7, 0x05, 0x29, 0x51,
417 0x3e, 0x3d, 0xa2, 0x67, 0x7f, 0xa5, 0x90, 0x6c, 0x5b, 0x3f, 0x7d,
418 0x8f, 0x92, 0xf2, 0x28, 0xbd, 0xa4, 0x0d, 0xda, 0x72, 0x14, 0x70,
419 0xf9, 0xfb, 0xf2, 0x97, 0xb5, 0xae, 0xa6, 0x17, 0x64, 0x6f, 0xac,
420 0x5c, 0x03, 0x27, 0x2e, 0x97, 0x07, 0x27, 0xc6, 0x21, 0xa7, 0x91,
421 0x41, 0xef, 0x5f, 0x7d, 0xe6, 0x50, 0x5e, 0x5b, 0xfb, 0xc3, 0x88,
422 0xe9, 0x33, 0x43, 0x69, 0x40, 0x93, 0x93, 0x4a, 0xe4, 0xd3, 0x57,
423 0xfa, 0xd6, 0xaa, 0xcb, 0x00, 0x21, 0x20, 0x3a, 0xdd, 0x4f, 0xb2,
424 0xd8, 0xfd, 0xf8, 0x22, 0xa0, 0xca, 0x3c, 0xf7, 0x67, 0x8e, 0xf5,
425 0xe8, 0x8d, 0xae, 0x99, 0x01, 0x41, 0xc5, 0x92, 0x4d, 0x57, 0xbb,
426 0x6f, 0xa3, 0x1b, 0x9e, 0x5f, 0x9d
427};
428
429/** RFC 8448 resumed 0-RTT test: ServerHello */
431 0x02, 0x00, 0x00, 0x5c, 0x03, 0x03, 0x3c, 0xcf, 0xd2, 0xde, 0xc8,
432 0x90, 0x22, 0x27, 0x63, 0x47, 0x2a, 0xe8, 0x13, 0x67, 0x77, 0xc9,
433 0xd7, 0x35, 0x87, 0x77, 0xbb, 0x66, 0xe9, 0x1e, 0xa5, 0x12, 0x24,
434 0x95, 0xf5, 0x59, 0xea, 0x2d, 0x00, 0x13, 0x01, 0x00, 0x00, 0x34,
435 0x00, 0x29, 0x00, 0x02, 0x00, 0x00, 0x00, 0x33, 0x00, 0x24, 0x00,
436 0x1d, 0x00, 0x20, 0x12, 0x17, 0x61, 0xee, 0x42, 0xc3, 0x33, 0xe1,
437 0xb9, 0xe7, 0x7b, 0x60, 0xdd, 0x57, 0xc2, 0x05, 0x3c, 0xd9, 0x45,
438 0x12, 0xab, 0x47, 0xf1, 0x15, 0xe8, 0x6e, 0xff, 0x50, 0x94, 0x2c,
439 0xea, 0x31, 0x00, 0x2b, 0x00, 0x02, 0x03, 0x04
440};
441
442/** RFC 8448 resumed 0-RTT test: ClientHello prefix length */
444 ( sizeof ( rfc8448_resumed_clienthello ) - 35 );
445
446/** RFC 8448 resumed 0-RTT test: EncryptedExtensions */
448 0x08, 0x00, 0x00, 0x28, 0x00, 0x26, 0x00, 0x0a, 0x00, 0x14, 0x00,
449 0x12, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x01, 0x00,
450 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x1c, 0x00,
451 0x02, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00
452};
453
454/** RFC 8448 resumed 0-RTT test: server Finished */
456 0x14, 0x00, 0x00, 0x20, 0x48, 0xd3, 0xe0, 0xe1, 0xb3, 0xd9, 0x07,
457 0xc6, 0xac, 0xff, 0x14, 0x5e, 0x16, 0x09, 0x03, 0x88, 0xc7, 0x7b,
458 0x05, 0xc0, 0x50, 0xb6, 0x34, 0xab, 0x1a, 0x88, 0xbb, 0xd0, 0xdd,
459 0x1a, 0x34, 0xb2
460};
461
462/** RFC 8448 resumed 0-RTT test: EndOfEarlyData */
464 0x05, 0x00, 0x00, 0x00
465};
466
467/** RFC 8448 resumed 0-RTT test: client Finished */
469 0x14, 0x00, 0x00, 0x20, 0x72, 0x30, 0xa9, 0xc9, 0x52, 0xc2, 0x5c,
470 0xd6, 0x13, 0x8f, 0xc5, 0xe6, 0x62, 0x83, 0x08, 0xc4, 0x1c, 0x53,
471 0x35, 0xdd, 0x81, 0xb9, 0xf9, 0x6b, 0xce, 0xa5, 0x0f, 0xd3, 0x2b,
472 0xda, 0x41, 0x6d
473};
474
475/** RFC 8448 resumed 0-RTT test: PSK binder */
477 0x3a, 0xdd, 0x4f, 0xb2, 0xd8, 0xfd, 0xf8, 0x22, 0xa0, 0xca, 0x3c,
478 0xf7, 0x67, 0x8e, 0xf5, 0xe8, 0x8d, 0xae, 0x99, 0x01, 0x41, 0xc5,
479 0x92, 0x4d, 0x57, 0xbb, 0x6f, 0xa3, 0x1b, 0x9e, 0x5f, 0x9d
480};
481
482/** RFC 8448 resumed 0-RTT test: early secret */
484 0x9b, 0x21, 0x88, 0xe9, 0xb2, 0xfc, 0x6d, 0x64, 0xd7, 0x1d, 0xc3,
485 0x29, 0x90, 0x0e, 0x20, 0xbb, 0x41, 0x91, 0x50, 0x00, 0xf6, 0x78,
486 0xaa, 0x83, 0x9c, 0xbb, 0x79, 0x7c, 0xb7, 0xd8, 0x33, 0x2c
487};
488
489/** RFC 8448 resumed 0-RTT test: client early traffic secret */
491 0x3f, 0xbb, 0xe6, 0xa6, 0x0d, 0xeb, 0x66, 0xc3, 0x0a, 0x32, 0x79,
492 0x5a, 0xba, 0x0e, 0xff, 0x7e, 0xaa, 0x10, 0x10, 0x55, 0x86, 0xe7,
493 0xbe, 0x5c, 0x09, 0x67, 0x8d, 0x63, 0xb6, 0xca, 0xab, 0x62
494};
495
496/** RFC 8448 resumed 0-RTT test: client early traffic key */
498 0x92, 0x02, 0x05, 0xa5, 0xb7, 0xbf, 0x21, 0x15, 0xe6, 0xfc, 0x5c,
499 0x29, 0x42, 0x83, 0x4f, 0x54
500};
501
502/** RFC 8448 resumed 0-RTT test: client early traffic IV */
504 0x6d, 0x47, 0x5f, 0x09, 0x93, 0xc8, 0xe5, 0x64, 0x61, 0x0d, 0xb2,
505 0xb9
506};
507
508/** RFC 8448 resumed 0-RTT test: handshake secret */
510 0x00, 0x5c, 0xb1, 0x12, 0xfd, 0x8e, 0xb4, 0xcc, 0xc6, 0x23, 0xbb,
511 0x88, 0xa0, 0x7c, 0x64, 0xb3, 0xed, 0xe1, 0x60, 0x53, 0x63, 0xfc,
512 0x7d, 0x0d, 0xf8, 0xc7, 0xce, 0x4f, 0xf0, 0xfb, 0x4a, 0xe6
513};
514
515/** RFC 8448 resumed 0-RTT test: client handshake traffic secret */
517 0x2f, 0xaa, 0xc0, 0x8f, 0x85, 0x1d, 0x35, 0xfe, 0xa3, 0x60, 0x4f,
518 0xcb, 0x4d, 0xe8, 0x2d, 0xc6, 0x2c, 0x9b, 0x16, 0x4a, 0x70, 0x97,
519 0x4d, 0x04, 0x62, 0xe2, 0x7f, 0x1a, 0xb2, 0x78, 0x70, 0x0f
520};
521
522/** RFC 8448 resumed 0-RTT test: client handshake traffic key */
524 0xb1, 0x53, 0x08, 0x06, 0xf4, 0xad, 0xfe, 0xac, 0x83, 0xf1, 0x41,
525 0x30, 0x32, 0xbb, 0xfa, 0x82
526};
527
528/** RFC 8448 resumed 0-RTT test: client handshake traffic IV */
530 0xeb, 0x50, 0xc1, 0x6b, 0xe7, 0x65, 0x4a, 0xbf, 0x99, 0xdd, 0x06,
531 0xd9
532};
533
534/** RFC 8448 resumed 0-RTT test: server handshake traffic secret */
536 0xfe, 0x92, 0x7a, 0xe2, 0x71, 0x31, 0x2e, 0x8b, 0xf0, 0x27, 0x5b,
537 0x58, 0x1c, 0x54, 0xee, 0xf0, 0x20, 0x45, 0x0d, 0xc4, 0xec, 0xff,
538 0xaa, 0x05, 0xa1, 0xa3, 0x5d, 0x27, 0x51, 0x8e, 0x78, 0x03
539};
540
541/** RFC 8448 resumed 0-RTT test: server handshake traffic key */
543 0x27, 0xc6, 0xbd, 0xc0, 0xa3, 0xdc, 0xea, 0x39, 0xa4, 0x73, 0x26,
544 0xd7, 0x9b, 0xc9, 0xe4, 0xee
545};
546
547/** RFC 8448 resumed 0-RTT test: server handshake traffic IV */
549 0x95, 0x69, 0xec, 0xdd, 0x4d, 0x05, 0x36, 0x70, 0x5e, 0x9e, 0xf7,
550 0x25
551};
552
553/** RFC 8448 resumed 0-RTT test: client verification */
555 0x72, 0x30, 0xa9, 0xc9, 0x52, 0xc2, 0x5c, 0xd6, 0x13, 0x8f, 0xc5,
556 0xe6, 0x62, 0x83, 0x08, 0xc4, 0x1c, 0x53, 0x35, 0xdd, 0x81, 0xb9,
557 0xf9, 0x6b, 0xce, 0xa5, 0x0f, 0xd3, 0x2b, 0xda, 0x41, 0x6d
558};
559
560/** RFC 8448 resumed 0-RTT test: server verification */
562 0x48, 0xd3, 0xe0, 0xe1, 0xb3, 0xd9, 0x07, 0xc6, 0xac, 0xff, 0x14,
563 0x5e, 0x16, 0x09, 0x03, 0x88, 0xc7, 0x7b, 0x05, 0xc0, 0x50, 0xb6,
564 0x34, 0xab, 0x1a, 0x88, 0xbb, 0xd0, 0xdd, 0x1a, 0x34, 0xb2
565};
566
567/** RFC 8448 resumed 0-RTT test: master secret */
569 0xe2, 0xd3, 0x2d, 0x4e, 0xd6, 0x6d, 0xd3, 0x78, 0x97, 0xa0, 0xe8,
570 0x0c, 0x84, 0x10, 0x75, 0x03, 0xce, 0x58, 0xbf, 0x8a, 0xad, 0x4c,
571 0xb5, 0x5a, 0x50, 0x02, 0xd7, 0x7e, 0xcb, 0x89, 0x0e, 0xce
572};
573
574/** RFC 8448 resumed 0-RTT test: client application traffic secret */
576 0x2a, 0xbb, 0xf2, 0xb8, 0xe3, 0x81, 0xd2, 0x3d, 0xbe, 0xbe, 0x1d,
577 0xd2, 0xa7, 0xd1, 0x6a, 0x8b, 0xf4, 0x84, 0xcb, 0x49, 0x50, 0xd2,
578 0x3f, 0xb7, 0xfb, 0x7f, 0xa8, 0x54, 0x70, 0x62, 0xd9, 0xa1
579};
580
581/** RFC 8448 resumed 0-RTT test: client application traffic key */
583 0x3c, 0xf1, 0x22, 0xf3, 0x01, 0xc6, 0x35, 0x8c, 0xa7, 0x98, 0x95,
584 0x53, 0x25, 0x0e, 0xfd, 0x72
585};
586
587/** RFC 8448 resumed 0-RTT test: client application traffic IV */
589 0xab, 0x1a, 0xec, 0x26, 0xaa, 0x78, 0xb8, 0xfc, 0x11, 0x76, 0xb9,
590 0xac
591};
592
593/** RFC 8448 resumed 0-RTT test: server application traffic secret */
595 0xcc, 0x21, 0xf1, 0xbf, 0x8f, 0xeb, 0x7d, 0xd5, 0xfa, 0x50, 0x5b,
596 0xd9, 0xc4, 0xb4, 0x68, 0xa9, 0x98, 0x4d, 0x55, 0x4a, 0x99, 0x3d,
597 0xc4, 0x9e, 0x6d, 0x28, 0x55, 0x98, 0xfb, 0x67, 0x26, 0x91
598};
599
600/** RFC 8448 resumed 0-RTT test: server application traffic key */
602 0xe8, 0x57, 0xc6, 0x90, 0xa3, 0x4c, 0x5a, 0x91, 0x29, 0xd8, 0x33,
603 0x61, 0x96, 0x84, 0xf9, 0x5e
604};
605
606/** RFC 8448 resumed 0-RTT test: server application traffic IV */
608 0x06, 0x85, 0xd6, 0xb5, 0x61, 0xaa, 0xb9, 0xef, 0x10, 0x13, 0xfa,
609 0xf9
610};
611
612/** RFC 8448 HelloRetryRequest test: client random bytes */
614 .bytes = {
615 0xb0, 0xb1, 0xc5, 0xa5, 0xaa, 0x37, 0xc5, 0x91, 0x9f, 0x2e,
616 0xd1, 0xd5, 0xc6, 0xff, 0xf7, 0xfc, 0xb7, 0x84, 0x97, 0x16,
617 0x94, 0x5a, 0x2b, 0x8c, 0xee, 0x92, 0x58, 0xa3, 0x46, 0x67,
618 0x7b, 0x6f
619 },
620};
621
622/** RFC 8448 HelloRetryRequest test: client P-256 private key */
624 0xab, 0x54, 0x73, 0x46, 0x7e, 0x19, 0x34, 0x6c, 0xeb, 0x0a, 0x04,
625 0x14, 0xe4, 0x1d, 0xa2, 0x1d, 0x4d, 0x24, 0x45, 0xbc, 0x30, 0x25,
626 0xaf, 0xe9, 0x7c, 0x4e, 0x8d, 0xc8, 0xd5, 0x13, 0xda, 0x39
627};
628
629/** RFC 8448 HelloRetryRequest test: server P-256 public key */
631 0x04, 0x58, 0x3e, 0x05, 0x4b, 0x7a, 0x66, 0x67, 0x2a, 0xe0, 0x20,
632 0xad, 0x9d, 0x26, 0x86, 0xfc, 0xc8, 0x5b, 0x5a, 0xd4, 0x1a, 0x13,
633 0x4a, 0x0f, 0x03, 0xee, 0x72, 0xb8, 0x93, 0x05, 0x2b, 0xd8, 0x5b,
634 0x4c, 0x8d, 0xe6, 0x77, 0x6f, 0x5b, 0x04, 0xac, 0x07, 0xd8, 0x35,
635 0x40, 0xea, 0xb3, 0xe3, 0xd9, 0xc5, 0x47, 0xbc, 0x65, 0x28, 0xc4,
636 0x31, 0x7d, 0x29, 0x46, 0x86, 0x09, 0x3a, 0x6c, 0xad, 0x7d
637};
638
639/** RFC 8448 HelloRetryRequest test: client hello (first) */
641 0x01, 0x00, 0x00, 0xb0, 0x03, 0x03, 0xb0, 0xb1, 0xc5, 0xa5, 0xaa,
642 0x37, 0xc5, 0x91, 0x9f, 0x2e, 0xd1, 0xd5, 0xc6, 0xff, 0xf7, 0xfc,
643 0xb7, 0x84, 0x97, 0x16, 0x94, 0x5a, 0x2b, 0x8c, 0xee, 0x92, 0x58,
644 0xa3, 0x46, 0x67, 0x7b, 0x6f, 0x00, 0x00, 0x06, 0x13, 0x01, 0x13,
645 0x03, 0x13, 0x02, 0x01, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x0b,
646 0x00, 0x09, 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
647 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x06,
648 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x33, 0x00, 0x26, 0x00,
649 0x24, 0x00, 0x1d, 0x00, 0x20, 0xe8, 0xe8, 0xe3, 0xf3, 0xb9, 0x3a,
650 0x25, 0xed, 0x97, 0xa1, 0x4a, 0x7d, 0xca, 0xcb, 0x8a, 0x27, 0x2c,
651 0x62, 0x88, 0xe5, 0x85, 0xc6, 0x48, 0x4d, 0x05, 0x26, 0x2f, 0xca,
652 0xd0, 0x62, 0xad, 0x1f, 0x00, 0x2b, 0x00, 0x03, 0x02, 0x03, 0x04,
653 0x00, 0x0d, 0x00, 0x20, 0x00, 0x1e, 0x04, 0x03, 0x05, 0x03, 0x06,
654 0x03, 0x02, 0x03, 0x08, 0x04, 0x08, 0x05, 0x08, 0x06, 0x04, 0x01,
655 0x05, 0x01, 0x06, 0x01, 0x02, 0x01, 0x04, 0x02, 0x05, 0x02, 0x06,
656 0x02, 0x02, 0x02, 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, 0x00, 0x1c,
657 0x00, 0x02, 0x40, 0x01
658};
659
660/** RFC 8448 HelloRetryRequest test: server hello (first) */
662 0x02, 0x00, 0x00, 0xac, 0x03, 0x03, 0xcf, 0x21, 0xad, 0x74, 0xe5,
663 0x9a, 0x61, 0x11, 0xbe, 0x1d, 0x8c, 0x02, 0x1e, 0x65, 0xb8, 0x91,
664 0xc2, 0xa2, 0x11, 0x16, 0x7a, 0xbb, 0x8c, 0x5e, 0x07, 0x9e, 0x09,
665 0xe2, 0xc8, 0xa8, 0x33, 0x9c, 0x00, 0x13, 0x01, 0x00, 0x00, 0x84,
666 0x00, 0x33, 0x00, 0x02, 0x00, 0x17, 0x00, 0x2c, 0x00, 0x74, 0x00,
667 0x72, 0x71, 0xdc, 0xd0, 0x4b, 0xb8, 0x8b, 0xc3, 0x18, 0x91, 0x19,
668 0x39, 0x8a, 0x00, 0x00, 0x00, 0x00, 0xee, 0xfa, 0xfc, 0x76, 0xc1,
669 0x46, 0xb8, 0x23, 0xb0, 0x96, 0xf8, 0xaa, 0xca, 0xd3, 0x65, 0xdd,
670 0x00, 0x30, 0x95, 0x3f, 0x4e, 0xdf, 0x62, 0x56, 0x36, 0xe5, 0xf2,
671 0x1b, 0xb2, 0xe2, 0x3f, 0xcc, 0x65, 0x4b, 0x1b, 0x5b, 0x40, 0x31,
672 0x8d, 0x10, 0xd1, 0x37, 0xab, 0xcb, 0xb8, 0x75, 0x74, 0xe3, 0x6e,
673 0x8a, 0x1f, 0x02, 0x5f, 0x7d, 0xfa, 0x5d, 0x6e, 0x50, 0x78, 0x1b,
674 0x5e, 0xda, 0x4a, 0xa1, 0x5b, 0x0c, 0x8b, 0xe7, 0x78, 0x25, 0x7d,
675 0x16, 0xaa, 0x30, 0x30, 0xe9, 0xe7, 0x84, 0x1d, 0xd9, 0xe4, 0xc0,
676 0x34, 0x22, 0x67, 0xe8, 0xca, 0x0c, 0xaf, 0x57, 0x1f, 0xb2, 0xb7,
677 0xcf, 0xf0, 0xf9, 0x34, 0xb0, 0x00, 0x2b, 0x00, 0x02, 0x03, 0x04
678};
679
680/** RFC 8448 HelloRetryRequest test: client hello (second) */
682 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03, 0xb0, 0xb1, 0xc5, 0xa5, 0xaa,
683 0x37, 0xc5, 0x91, 0x9f, 0x2e, 0xd1, 0xd5, 0xc6, 0xff, 0xf7, 0xfc,
684 0xb7, 0x84, 0x97, 0x16, 0x94, 0x5a, 0x2b, 0x8c, 0xee, 0x92, 0x58,
685 0xa3, 0x46, 0x67, 0x7b, 0x6f, 0x00, 0x00, 0x06, 0x13, 0x01, 0x13,
686 0x03, 0x13, 0x02, 0x01, 0x00, 0x01, 0xcd, 0x00, 0x00, 0x00, 0x0b,
687 0x00, 0x09, 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
688 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x06,
689 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x33, 0x00, 0x47, 0x00,
690 0x45, 0x00, 0x17, 0x00, 0x41, 0x04, 0xa6, 0xda, 0x73, 0x92, 0xec,
691 0x59, 0x1e, 0x17, 0xab, 0xfd, 0x53, 0x59, 0x64, 0xb9, 0x98, 0x94,
692 0xd1, 0x3b, 0xef, 0xb2, 0x21, 0xb3, 0xde, 0xf2, 0xeb, 0xe3, 0x83,
693 0x0e, 0xac, 0x8f, 0x01, 0x51, 0x81, 0x26, 0x77, 0xc4, 0xd6, 0xd2,
694 0x23, 0x7e, 0x85, 0xcf, 0x01, 0xd6, 0x91, 0x0c, 0xfb, 0x83, 0x95,
695 0x4e, 0x76, 0xba, 0x73, 0x52, 0x83, 0x05, 0x34, 0x15, 0x98, 0x97,
696 0xe8, 0x06, 0x57, 0x80, 0x00, 0x2b, 0x00, 0x03, 0x02, 0x03, 0x04,
697 0x00, 0x0d, 0x00, 0x20, 0x00, 0x1e, 0x04, 0x03, 0x05, 0x03, 0x06,
698 0x03, 0x02, 0x03, 0x08, 0x04, 0x08, 0x05, 0x08, 0x06, 0x04, 0x01,
699 0x05, 0x01, 0x06, 0x01, 0x02, 0x01, 0x04, 0x02, 0x05, 0x02, 0x06,
700 0x02, 0x02, 0x02, 0x00, 0x2c, 0x00, 0x74, 0x00, 0x72, 0x71, 0xdc,
701 0xd0, 0x4b, 0xb8, 0x8b, 0xc3, 0x18, 0x91, 0x19, 0x39, 0x8a, 0x00,
702 0x00, 0x00, 0x00, 0xee, 0xfa, 0xfc, 0x76, 0xc1, 0x46, 0xb8, 0x23,
703 0xb0, 0x96, 0xf8, 0xaa, 0xca, 0xd3, 0x65, 0xdd, 0x00, 0x30, 0x95,
704 0x3f, 0x4e, 0xdf, 0x62, 0x56, 0x36, 0xe5, 0xf2, 0x1b, 0xb2, 0xe2,
705 0x3f, 0xcc, 0x65, 0x4b, 0x1b, 0x5b, 0x40, 0x31, 0x8d, 0x10, 0xd1,
706 0x37, 0xab, 0xcb, 0xb8, 0x75, 0x74, 0xe3, 0x6e, 0x8a, 0x1f, 0x02,
707 0x5f, 0x7d, 0xfa, 0x5d, 0x6e, 0x50, 0x78, 0x1b, 0x5e, 0xda, 0x4a,
708 0xa1, 0x5b, 0x0c, 0x8b, 0xe7, 0x78, 0x25, 0x7d, 0x16, 0xaa, 0x30,
709 0x30, 0xe9, 0xe7, 0x84, 0x1d, 0xd9, 0xe4, 0xc0, 0x34, 0x22, 0x67,
710 0xe8, 0xca, 0x0c, 0xaf, 0x57, 0x1f, 0xb2, 0xb7, 0xcf, 0xf0, 0xf9,
711 0x34, 0xb0, 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, 0x00, 0x1c, 0x00,
712 0x02, 0x40, 0x01, 0x00, 0x15, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x00,
713 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
714 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
715 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
716 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
717 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
723 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
724 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
726 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
727 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
728 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
729};
730
731/** RFC 8448 HelloRetryRequest test: server hello (second) */
733 0x02, 0x00, 0x00, 0x77, 0x03, 0x03, 0xbb, 0x34, 0x1d, 0x84, 0x7f,
734 0xd7, 0x89, 0xc4, 0x7c, 0x38, 0x71, 0x72, 0xdc, 0x0c, 0x9b, 0xf1,
735 0x47, 0xfc, 0xca, 0xcb, 0x50, 0x43, 0xd8, 0x6c, 0xa4, 0xc5, 0x98,
736 0xd3, 0xff, 0x57, 0x1b, 0x98, 0x00, 0x13, 0x01, 0x00, 0x00, 0x4f,
737 0x00, 0x33, 0x00, 0x45, 0x00, 0x17, 0x00, 0x41, 0x04, 0x58, 0x3e,
738 0x05, 0x4b, 0x7a, 0x66, 0x67, 0x2a, 0xe0, 0x20, 0xad, 0x9d, 0x26,
739 0x86, 0xfc, 0xc8, 0x5b, 0x5a, 0xd4, 0x1a, 0x13, 0x4a, 0x0f, 0x03,
740 0xee, 0x72, 0xb8, 0x93, 0x05, 0x2b, 0xd8, 0x5b, 0x4c, 0x8d, 0xe6,
741 0x77, 0x6f, 0x5b, 0x04, 0xac, 0x07, 0xd8, 0x35, 0x40, 0xea, 0xb3,
742 0xe3, 0xd9, 0xc5, 0x47, 0xbc, 0x65, 0x28, 0xc4, 0x31, 0x7d, 0x29,
743 0x46, 0x86, 0x09, 0x3a, 0x6c, 0xad, 0x7d, 0x00, 0x2b, 0x00, 0x02,
744 0x03, 0x04
745};
746
747/** RFC 8448 HelloRetryRequest test: handshake secret */
749 0xce, 0x02, 0x2e, 0x5e, 0x6e, 0x81, 0xe5, 0x07, 0x36, 0xd7, 0x73,
750 0xf2, 0xd3, 0xad, 0xfc, 0xe8, 0x22, 0x0d, 0x04, 0x9b, 0xf5, 0x10,
751 0xf0, 0xdb, 0xfa, 0xc9, 0x27, 0xef, 0x42, 0x43, 0xb1, 0x48
752};
753
754/** RFC 8448 HelloRetryRequest test: client handshake traffic secret */
756 0x15, 0x8a, 0xa7, 0xab, 0x88, 0x55, 0x07, 0x35, 0x82, 0xb4, 0x1d,
757 0x67, 0x4b, 0x40, 0x55, 0xca, 0xbc, 0xc5, 0x34, 0x72, 0x8f, 0x65,
758 0x93, 0x14, 0x86, 0x1b, 0x4e, 0x08, 0xe2, 0x01, 0x15, 0x66
759};
760
761/** RFC 8448 HelloRetryRequest test: server handshake traffic secret */
763 0x34, 0x03, 0xe7, 0x81, 0xe2, 0xaf, 0x7b, 0x65, 0x08, 0xda, 0x28,
764 0x57, 0x4f, 0x6e, 0x95, 0xa1, 0xab, 0xf1, 0x62, 0xde, 0x83, 0xa9,
765 0x79, 0x27, 0xc3, 0x76, 0x72, 0xa4, 0xa0, 0xce, 0xf8, 0xa1
766};
767
768/** Dummy minimal tests: client random bytes */
769static const struct tls_random dummy_client_nonce = {
770 .bytes = {
771 0x86, 0x75, 0xa3, 0x00, 0x0c, 0x3d, 0x73, 0x79, 0xa3, 0x78,
772 0x04, 0xfc, 0x5d, 0x7f, 0x99, 0xef, 0xf1, 0x9e, 0xda, 0x74,
773 0x80, 0x3c, 0x60, 0x83, 0xac, 0xbe, 0x15, 0xae, 0x11, 0x3f,
774 0xbe, 0xba
775 },
776};
777
778/** Dummy minimal tests: ClientHello */
779static const uint8_t dummy_clienthello[] = {
780 0x01, 0x00, 0x00, 0x22, 0x03, 0x02, 0x86, 0x75, 0xa3, 0x00, 0x0c,
781 0x3d, 0x73, 0x79, 0xa3, 0x78, 0x04, 0xfc, 0x5d, 0x7f, 0x99, 0xef,
782 0xf1, 0x9e, 0xda, 0x74, 0x80, 0x3c, 0x60, 0x83, 0xac, 0xbe, 0x15,
783 0xae, 0x11, 0x3f, 0xbe, 0xba
784};
785
786/** Dummy minimal tests: ServerHello */
787static const uint8_t dummy_serverhello[] = {
788 0x02, 0x00, 0x00, 0x22, 0x03, 0x02, 0xa3, 0xdd, 0xe4, 0x56, 0xda,
789 0xc8, 0x65, 0xd8, 0x2c, 0xc3, 0xb0, 0x47, 0x49, 0x2f, 0xdb, 0xfd,
790 0xc3, 0xaf, 0x6b, 0x60, 0x98, 0xe1, 0x99, 0xb3, 0xd4, 0x9b, 0x55,
791 0x15, 0x43, 0x8d, 0xec, 0x3e
792};
793
794/** Dummy minimal tests: pre-master secret */
795static const uint8_t dummy_premaster[] = {
796 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64,
797 0x21, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61,
798 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x70, 0x72, 0x65, 0x2d,
799 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x73, 0x65, 0x63, 0x72,
800 0x65, 0x74, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x6f,
801 0x75, 0x67, 0x68, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x71, 0x75,
802 0x69, 0x72, 0x65, 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x6b, 0x65,
803 0x79, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69,
804 0x6f, 0x6e, 0x2e
805};
806
807/** Dummy minimal tests: ServerKeyExchange DH parameters */
808static const uint8_t dummy_dh_param[] = {
809 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c
810};
811
812/** Dummy minimal TLSv1.2 test: master secret */
814 0x6f, 0x57, 0xe7, 0xab, 0xd9, 0x0c, 0xcc, 0x99, 0xe0, 0x18, 0xa6,
815 0x2b, 0x7c, 0x7d, 0x04, 0x84, 0x18, 0x37, 0xee, 0x9e, 0xad, 0x47,
816 0x54, 0x6e, 0xd4, 0xd0, 0x84, 0x99, 0x91, 0x5d, 0x8f, 0xee, 0xfa,
817 0xec, 0x08, 0x21, 0x35, 0x2d, 0x1e, 0xe3, 0x4b, 0xe5, 0xbf, 0x81,
818 0xc2, 0x23, 0x47, 0x10
819};
820
821/** Dummy minimal TLSv1.2 test: client verification */
823 0xd6, 0x5d, 0xbb, 0xff, 0x72, 0xc5, 0x51, 0xa5, 0xa9, 0x53, 0x85,
824 0xab
825};
826
827/** Dummy minimal TLSv1.2 test: server verification */
829 0x6c, 0xe4, 0x95, 0x70, 0xc3, 0x8d, 0x2a, 0xcd, 0x2d, 0x8b, 0x0b,
830 0x33
831};
832
833/** Dummy minimal TLSv1.2 test: client traffic key */
835 0xda, 0x2a, 0x4b, 0xbd, 0x5b, 0x0a, 0xa5, 0xd3, 0x30, 0x54, 0x9a,
836 0xcc, 0x99, 0x28, 0x93, 0xfa
837};
838
839/** Dummy minimal TLSv1.2 test: client traffic IV */
841 0xcd, 0xa5, 0x5a, 0x1d
842};
843
844/** Dummy minimal TLSv1.2 test: client traffic MAC */
846 0xe8, 0x4e, 0x9b, 0x7a, 0xb9, 0x97, 0x7d, 0x47, 0xfb, 0x4a, 0xe8,
847 0x1e, 0xb6, 0x6e, 0xfc, 0x2b, 0x94, 0x8a, 0xd4, 0x75, 0xde, 0xd9,
848 0xb9, 0x73, 0x23, 0x16, 0x06, 0x2f, 0x96, 0xb0, 0xb6, 0xcb
849};
850
851/** Dummy minimal TLSv1.2 test: server traffic key */
853 0x0b, 0x58, 0x8a, 0xbc, 0x5a, 0x6a, 0x44, 0x33, 0xdc, 0x60, 0xd4,
854 0xd1, 0xf1, 0x9b, 0xba, 0xd7
855};
856
857/** Dummy minimal TLSv1.2 test: server traffic IV */
859 0xa2, 0x35, 0xf7, 0x40
860};
861
862/** Dummy minimal TLSv1.2 test: server traffic MAC */
864 0x16, 0x7c, 0x12, 0x5d, 0x85, 0x84, 0xfd, 0x5e, 0xf1, 0x3d, 0x0f,
865 0x5a, 0xbf, 0xf6, 0x44, 0x22, 0x93, 0xf8, 0xea, 0x17, 0x3c, 0x0b,
866 0x4e, 0xdf, 0x82, 0x5e, 0x26, 0xd0, 0xcb, 0xe5, 0xac, 0xa4
867};
868
869/** Dummy minimal TLSv1.2 test: client signable digest */
871 0x14, 0x3b, 0xc1, 0x0c, 0x25, 0xf3, 0x6a, 0x4d, 0x4a, 0x7a, 0xd9,
872 0xb2, 0xee, 0x7e, 0x48, 0xc8, 0xf4, 0x71, 0x53, 0xb0, 0x69, 0x29,
873 0xe5, 0x2c, 0x0d, 0xeb, 0xa3, 0xf9, 0xe1, 0xcd, 0x02, 0x3d
874};
875
876/** Dummy minimal TLSv1.2 test: server signable digest */
878 0xd4, 0x11, 0x45, 0x52, 0xa6, 0xf0, 0xe5, 0xe0, 0x5e, 0x20, 0x99,
879 0x77, 0x5e, 0x0c, 0xbe, 0xce, 0x3e, 0xd9, 0x81, 0xf7, 0x73, 0x49,
880 0xc1, 0xab, 0xf2, 0xd3, 0x1e, 0xf7, 0xf3, 0x72, 0xc4, 0x15
881};
882
883/** Dummy minimal TLSv1.0 test: master secret (MD5 portion) */
885 0xed, 0x60, 0x7e, 0x6b, 0xce, 0xcb, 0x2c, 0xaf, 0x04, 0x19, 0xeb,
886 0xee, 0xbd, 0x35, 0xfa, 0x85, 0xc2, 0xcf, 0x5b, 0x5d, 0xea, 0x62,
887 0xae, 0xe2,
888};
889
890/** Dummy minimal TLSv1.0 test: master secret (SHA-1 portion) */
892 0xa2, 0x81, 0x2c, 0x2f, 0xbd, 0x69, 0x59, 0x19, 0xb8, 0xe5, 0x41,
893 0xfc, 0xb0, 0x63, 0x21, 0xbd, 0xd6, 0xca, 0x15, 0xab, 0xb1, 0x18,
894 0xea, 0x14
895};
896
897/** Dummy minimal TLSv1.0 test: client verification */
899 0xc3, 0x50, 0x18, 0xee, 0x24, 0x70, 0x27, 0x6a, 0x98, 0xe0, 0xd0,
900 0x73
901};
902
903/** Dummy minimal TLSv1.0 test: server verification */
905 0xcb, 0xa0, 0xc8, 0x13, 0x10, 0xc4, 0xba, 0xe1, 0x4c, 0xe3, 0x99,
906 0xeb
907};
908
909/** Dummy minimal TLSv1.0 test: client traffic key */
911 0x0e, 0xa5, 0x90, 0xb8, 0x12, 0xa2, 0xf0, 0xe1, 0xaa, 0x0a, 0xba,
912 0x85, 0x8d, 0x73, 0xcd, 0x99
913};
914
915/** Dummy minimal TLSv1.0 test: client traffic IV */
917 0xac, 0x25, 0xe7, 0x78
918};
919
920/** Dummy minimal TLSv1.0 test: client traffic MAC */
922 0x84, 0xe9, 0x05, 0xb6, 0xb0, 0x21, 0x71, 0x10, 0x93, 0xdd, 0xc7,
923 0x0b, 0xb8, 0x03, 0x3e, 0x14, 0x25, 0x69, 0xfe, 0xd6, 0xb3, 0x90,
924 0xf0, 0x0b, 0xa0, 0x9a, 0xff, 0x9b, 0x02, 0xc4, 0x3a, 0x49
925};
926
927/** Dummy minimal TLSv1.0 test: server traffic key */
929 0x7a, 0xea, 0x6d, 0xb8, 0x9d, 0xa8, 0xc5, 0x64, 0x7c, 0xd7, 0x0d,
930 0xc4, 0x1a, 0xfa, 0x92, 0x26
931};
932
933/** Dummy minimal TLSv1.0 test: server traffic IV */
935 0xa0, 0xa9, 0x81, 0x33
936};
937
938/** Dummy minimal TLSv1.0 test: server traffic MAC */
940 0x39, 0x7b, 0x90, 0xd7, 0xc8, 0xe3, 0x11, 0x4b, 0x39, 0x47, 0x56,
941 0x6a, 0xe5, 0xb8, 0x40, 0x4e, 0x58, 0xad, 0x8a, 0x1a, 0xbf, 0x9a,
942 0x91, 0x40, 0x44, 0x7d, 0xa3, 0xd0, 0x0b, 0x42, 0xa8, 0x09
943};
944
945/**
946 * Perform RFC 8448 simple 1-RTT test
947 *
948 * @v tlskey Key schedule
949 * @v psk Pre-shared key from which to resume
950 */
951static void rfc8448_simple_test ( struct tls_key_schedule *tlskey,
952 struct tls_preshared_key *psk ) {
953 struct exchange_algorithm *exchange = &x25519_algorithm;
954 struct digest_algorithm *digest = &sha256_algorithm;
955 size_t sharedsize = exchange->sharedsize;
956 size_t digestsize = digest->digestsize;
957 uint8_t shared[sharedsize];
958 uint8_t tbshash[digestsize];
959 uint8_t verify[digestsize];
960 uint8_t key[16];
961 uint8_t iv[12];
962
963 /* Start key schedule */
964 ok ( tlskey_start ( tlskey, &tlskey_hkdf, digest,
966
967 /* Early secret */
969 tlskey->kdf.secret, digestsize ) == 0 );
970
971 /* ClientHello */
973 sizeof ( rfc8448_simple_clienthello ) );
974
975 /* ServerHello */
977 sizeof ( rfc8448_simple_serverhello ) );
979 rfc8448_simple_x25519_partner, shared ) == 0 );
980 ok ( tlskey_apply ( tlskey, shared, sizeof ( shared ) ) == 0 );
981
982 /* Handshake secret */
984 tlskey->kdf.secret, digestsize ) == 0 );
985
986 /* Client handshake traffic secret */
987 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_handshake ) == 0 );
989 tlskey->traffic[TLS_CLIENT].secret, digestsize ) == 0 );
990
991 /* Server handshake traffic secret */
992 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_handshake ) == 0 );
994 tlskey->traffic[TLS_SERVER].secret, digestsize ) == 0 );
995
996 /* Master secret */
997 ok ( tlskey_master ( tlskey, 1 ) == 0 );
999 tlskey->kdf.secret, digestsize ) == 0 );
1000
1001 /* Server handshake traffic keys */
1002 ok ( tlskey_cipher ( tlskey, &tls_server, key, sizeof ( key ),
1003 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1005 key, sizeof ( key ) ) == 0 );
1007 iv, sizeof ( iv ) ) == 0 );
1008
1009 /* EncryptedExtensions */
1012
1013 /* Certificate */
1015 sizeof ( rfc8448_simple_certificate ) );
1016
1017 /* CertificateVerify signable digest */
1018 ok ( tlskey_tbshash ( tlskey, &tls_server, digest, NULL, 0,
1019 tbshash ) == 0 );
1021 tbshash, sizeof ( tbshash ) ) == 0 );
1022
1023 /* CertificateVerify */
1026
1027 /* Server verification */
1028 ok ( tlskey_verify ( tlskey, &tls_server, verify,
1029 sizeof ( verify ) ) == 0 );
1031 verify, sizeof ( verify ) ) == 0 );
1032
1033 /* Server Finished */
1035 sizeof ( rfc8448_simple_server_finished ) );
1036
1037 /* Server application traffic secret */
1038 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_application ) == 0 );
1040 tlskey->traffic[TLS_SERVER].secret, digestsize ) == 0 );
1041
1042 /* Server application traffic keys */
1043 ok ( tlskey_cipher ( tlskey, &tls_server, key, sizeof ( key ),
1044 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1046 key, sizeof ( key ) ) == 0 );
1048 iv, sizeof ( iv ) ) == 0 );
1049
1050 /* Client handshake traffic keys */
1051 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1052 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1054 key, sizeof ( key ) ) == 0 );
1056 iv, sizeof ( iv ) ) == 0 );
1057
1058 /* Client verification */
1059 ok ( tlskey_verify ( tlskey, &tls_client, verify,
1060 sizeof ( verify ) ) == 0 );
1062 verify, sizeof ( verify ) ) == 0 );
1063
1064 /* Client application traffic secret */
1065 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_application ) == 0 );
1067 tlskey->traffic[TLS_CLIENT].secret, digestsize ) == 0 );
1068
1069 /* Client Finished */
1071 sizeof ( rfc8448_simple_client_finished ) );
1072
1073 /* Client application traffic keys */
1074 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1075 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1077 key, sizeof ( key ) ) == 0 );
1079 iv, sizeof ( iv ) ) == 0 );
1080
1081 /* NewSessionTicket */
1084
1085 /* Resumption secret */
1087 sizeof ( rfc8448_simple_ticket_nonce ),
1088 psk ) == 0 );
1090 psk->key.resumption, digestsize ) == 0 );
1091
1092 /* Stop key schedule */
1093 tlskey_stop ( tlskey );
1094}
1095
1096/**
1097 * Perform RFC 8448 resumed 0-RTT test
1098 *
1099 * @v tlskey Key schedule
1100 * @v psk Pre-shared key from which to resume
1101 */
1102static void rfc8448_resumed_test ( struct tls_key_schedule *tlskey,
1103 struct tls_preshared_key *psk ) {
1104 struct exchange_algorithm *exchange = &x25519_algorithm;
1105 struct digest_algorithm *digest = &sha256_algorithm;
1106 size_t sharedsize = exchange->sharedsize;
1107 size_t digestsize = digest->digestsize;
1108 uint8_t shared[sharedsize];
1109 uint8_t binder[digestsize];
1110 uint8_t verify[digestsize];
1111 uint8_t key[16];
1112 int8_t iv[12];
1113
1114 /* Start key schedule */
1115 ok ( tlskey_start ( tlskey, &tlskey_hkdf, digest,
1117
1118 /* ClientHello */
1121 binder, sizeof ( binder ) ) == 0 );
1123 binder, sizeof ( binder ) ) == 0 );
1125 sizeof ( rfc8448_resumed_clienthello ) );
1126
1127 /* Early secret */
1128 ok ( tlskey_load ( tlskey, 1, psk ) == 0 );
1130 tlskey->kdf.secret, digestsize ) == 0 );
1131
1132 /* Client early traffic secret */
1133 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_early ) == 0 );
1135 tlskey->traffic[TLS_CLIENT].secret, digestsize ) == 0 );
1136
1137 /* Client early traffic keys */
1138 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1139 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1141 key, sizeof ( key ) ) == 0 );
1143 iv, sizeof ( iv ) ) == 0 );
1144
1145 /* ServerHello */
1147 sizeof ( rfc8448_resumed_serverhello ) );
1149 rfc8448_resumed_x25519_partner, shared ) == 0 );
1150 ok ( tlskey_apply ( tlskey, shared, sizeof ( shared ) ) == 0 );
1151
1152 /* Handshake secret */
1154 tlskey->kdf.secret, digestsize ) == 0 );
1155
1156 /* Client handshake traffic secret */
1157 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_handshake ) == 0 );
1159 tlskey->traffic[TLS_CLIENT].secret, digestsize ) == 0 );
1160
1161 /* Server handshake traffic secret */
1162 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_handshake ) == 0 );
1164 tlskey->traffic[TLS_SERVER].secret, digestsize ) == 0 );
1165
1166 /* Master secret */
1167 ok ( tlskey_master ( tlskey, 1 ) == 0 );
1169 tlskey->kdf.secret, digestsize ) == 0 );
1170
1171 /* Server handshake traffic keys */
1172 ok ( tlskey_cipher ( tlskey, &tls_server, key, sizeof ( key ),
1173 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1175 key, sizeof ( key ) ) == 0 );
1177 iv, sizeof ( iv ) ) == 0 );
1178
1179 /* EncryptedExtensions */
1182
1183 /* Server verification */
1184 ok ( tlskey_verify ( tlskey, &tls_server, verify,
1185 sizeof ( verify ) ) == 0 );
1187 verify, sizeof ( verify ) ) == 0 );
1188
1189 /* Server Finished */
1192
1193 /* Server application traffic secret */
1194 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_application ) == 0 );
1196 tlskey->traffic[TLS_SERVER].secret, digestsize ) == 0 );
1197
1198 /* Server application traffic keys */
1199 ok ( tlskey_cipher ( tlskey, &tls_server, key, sizeof ( key ),
1200 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1202 key, sizeof ( key ) ) == 0 );
1204 iv, sizeof ( iv ) ) == 0 );
1205
1206 /* Client handshake traffic keys */
1207 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1208 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1210 key, sizeof ( key ) ) == 0 );
1212 iv, sizeof ( iv ) ) == 0 );
1213
1214 /* EndOfEarlyData */
1216 sizeof ( rfc8448_resumed_endofearlydata ) );
1217
1218 /* Client verification */
1219 ok ( tlskey_verify ( tlskey, &tls_client, verify,
1220 sizeof ( verify ) ) == 0 );
1222 verify, sizeof ( verify ) ) == 0 );
1223
1224 /* Client application traffic secret */
1225 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_application ) == 0 );
1227 tlskey->traffic[TLS_CLIENT].secret, digestsize ) == 0 );
1228
1229 /* Client Finished */
1232
1233 /* Client application traffic keys */
1234 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1235 iv, sizeof ( iv ), NULL, 0 ) == 0 );
1237 key, sizeof ( key ) ) == 0 );
1239 iv, sizeof ( iv ) ) == 0 );
1240
1241 /* Stop key schedule */
1242 tlskey_stop ( tlskey );
1243}
1244
1245/**
1246 * Perform RFC 8448 HelloRetryRequest test
1247 *
1248 * @v tlskey Key schedule
1249 */
1250static void rfc8448_hrr_test ( struct tls_key_schedule *tlskey ) {
1251 struct exchange_algorithm *exchange = &p256_algorithm;
1252 struct digest_algorithm *digest = &sha256_algorithm;
1253 size_t sharedsize = exchange->sharedsize;
1254 size_t digestsize = digest->digestsize;
1255 uint8_t shared[sharedsize];
1256
1257 /* Start key schedule */
1258 ok ( tlskey_start ( tlskey, &tlskey_hkdf, digest,
1259 &rfc8448_hrr_client_nonce ) == 0 );
1260
1261 /* ClientHello1 */
1263 sizeof ( rfc8448_hrr_clienthello1 ) );
1264
1265 /* Synthesize message hash */
1266 tlskey_message ( tlskey );
1267
1268 /* ServerHello1 */
1270 sizeof ( rfc8448_hrr_serverhello1 ) );
1271
1272 /* ClientHello2 */
1274 sizeof ( rfc8448_hrr_clienthello2 ) );
1275
1276 /* ServerHello2 */
1278 sizeof ( rfc8448_hrr_serverhello2 ) );
1280 rfc8448_hrr_p256_partner, shared ) == 0 );
1281 ok ( tlskey_apply ( tlskey, shared, sizeof ( shared ) ) == 0 );
1282
1283 /* Handshake secret */
1285 tlskey->kdf.secret, digestsize ) == 0 );
1286
1287 /* Client handshake traffic secret */
1288 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_handshake ) == 0 );
1290 tlskey->traffic[TLS_CLIENT].secret, digestsize ) == 0 );
1291
1292 /* Server handshake traffic secret */
1293 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_handshake ) == 0 );
1295 tlskey->traffic[TLS_SERVER].secret, digestsize ) == 0 );
1296}
1297
1298/**
1299 * Perform dummy TLS version 1.2 test
1300 *
1301 * @v tlskey Key schedule
1302 * @v psk Pre-shared key
1303 */
1304static void dummy_hash ( struct tls_key_schedule *tlskey,
1305 struct tls_preshared_key *psk ) {
1306 struct digest_algorithm *digest = &sha256_algorithm;
1307 size_t digestsize = digest->digestsize;
1308 const int extended = 1;
1309 uint8_t tbshash[digestsize];
1310 uint8_t verify[12];
1311 uint8_t key[16];
1312 uint8_t iv[4];
1313 uint8_t mac[32];
1314
1315 /* Start key schedule */
1316 ok ( tlskey_start ( tlskey, &tlskey_hash, digest,
1317 &dummy_client_nonce ) == 0 );
1318
1319 /* ClientHello */
1321 sizeof ( dummy_clienthello ) );
1322
1323 /* ServerHello */
1325 sizeof ( dummy_serverhello ) );
1326
1327 /* Pre-master secret */
1328 ok ( tlskey_apply ( tlskey, dummy_premaster,
1329 sizeof ( dummy_premaster ) ) == 0 );
1330
1331 /* Master secret */
1332 ok ( tlskey_master ( tlskey, extended ) == 0 );
1334 sizeof ( dummy_hash_master_secret ) ) == 0 );
1335
1336 /* Client verification */
1337 ok ( tlskey_verify ( tlskey, &tls_client, verify,
1338 sizeof ( verify ) ) == 0 );
1340 sizeof ( verify ) ) == 0 );
1341
1342 /* Server verification */
1343 ok ( tlskey_verify ( tlskey, &tls_server, verify,
1344 sizeof ( verify ) ) == 0 );
1346 sizeof ( verify ) ) == 0 );
1347
1348 /* Client traffic keys */
1349 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_application ) == 0 );
1350 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1351 iv, sizeof ( iv ), mac, sizeof ( mac ) ) == 0 );
1353 key, sizeof ( key ) ) == 0 );
1355 iv, sizeof ( iv ) ) == 0 );
1357 mac, sizeof ( mac ) ) == 0 );
1358
1359 /* Server traffic keys */
1360 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_application ) == 0 );
1361 ok ( tlskey_cipher ( tlskey, &tls_server, key, sizeof ( key ),
1362 iv, sizeof ( iv ), mac, sizeof ( mac ) ) == 0 );
1364 key, sizeof ( key ) ) == 0 );
1366 iv, sizeof ( iv ) ) == 0 );
1368 mac, sizeof ( mac ) ) == 0 );
1369
1370 /* Client signable digest */
1371 ok ( tlskey_tbshash ( tlskey, &tls_client, digest, NULL, 0,
1372 tbshash ) == 0 );
1374 tbshash, sizeof ( tbshash ) ) == 0 );
1375
1376 /* Server signable digest */
1377 ok ( tlskey_tbshash ( tlskey, &tls_server, digest, dummy_dh_param,
1378 sizeof ( dummy_dh_param ), tbshash ) == 0 );
1380 tbshash, sizeof ( tbshash ) ) == 0 );
1381
1382 /* Save resumption secret */
1383 ok ( tlskey_save ( tlskey, NULL, 0, psk ) == 0 );
1384
1385 /* Stop key schedule */
1386 tlskey_stop ( tlskey );
1387
1388 /* Start key schedule */
1389 ok ( tlskey_start ( tlskey, &tlskey_hash, digest,
1390 &dummy_client_nonce ) == 0 );
1391
1392 /* ClientHello */
1394 sizeof ( dummy_clienthello ) );
1395
1396 /* ServerHello */
1398 sizeof ( dummy_serverhello ) );
1399
1400 /* Load resumption secret */
1402 sizeof ( dummy_hash_master_secret ) ) != 0 );
1403 ok ( tlskey_load ( tlskey, extended, psk ) == 0 );
1405 sizeof ( dummy_hash_master_secret ) ) == 0 );
1406
1407 /* Stop key schedule */
1408 tlskey_stop ( tlskey );
1409}
1410
1411/**
1412 * Perform dummy TLS version 1.0 test
1413 *
1414 * @v tlskey Key schedule
1415 * @v psk Pre-shared key
1416 */
1417static void dummy_md5_sha1 ( struct tls_key_schedule *tlskey,
1418 struct tls_preshared_key *psk ) {
1419 struct digest_algorithm *digest = &md5_sha1_algorithm;
1420 const struct md5_sha1_hmac_keys *hkeys;
1421 const int extended = 0;
1422 uint8_t verify[12];
1423 uint8_t key[16];
1424 uint8_t iv[4];
1425 uint8_t mac[32];
1426
1427 /* Start key schedule */
1428 ok ( tlskey_start ( tlskey, &tlskey_md5_sha1, digest,
1429 &dummy_client_nonce ) == 0 );
1430 hkeys = tlskey->kdf.secret;
1431
1432 /* ClientHello */
1434 sizeof ( dummy_clienthello ) );
1435
1436 /* ServerHello */
1438 sizeof ( dummy_serverhello ) );
1439
1440 /* Pre-master secret */
1441 ok ( tlskey_apply ( tlskey, dummy_premaster,
1442 sizeof ( dummy_premaster ) ) == 0 );
1443
1444 /* Master secret */
1445 ok ( tlskey_master ( tlskey, extended ) == 0 );
1447 sizeof ( dummy_md5_sha1_master_secret_md5 ) ) == 0 );
1449 sizeof ( dummy_md5_sha1_master_secret_sha1 ) ) == 0 );
1450
1451 /* Client verification */
1452 ok ( tlskey_verify ( tlskey, &tls_client, verify,
1453 sizeof ( verify ) ) == 0 );
1455 sizeof ( verify ) ) == 0 );
1456
1457 /* Server verification */
1458 ok ( tlskey_verify ( tlskey, &tls_server, verify,
1459 sizeof ( verify ) ) == 0 );
1461 sizeof ( verify ) ) == 0 );
1462
1463 /* Client traffic keys */
1464 ok ( tlskey_traffic ( tlskey, &tls_client, &tls_application ) == 0 );
1465 ok ( tlskey_cipher ( tlskey, &tls_client, key, sizeof ( key ),
1466 iv, sizeof ( iv ), mac, sizeof ( mac ) ) == 0 );
1468 key, sizeof ( key ) ) == 0 );
1470 iv, sizeof ( iv ) ) == 0 );
1472 mac, sizeof ( mac ) ) == 0 );
1473
1474 /* Server traffic keys */
1475 ok ( tlskey_traffic ( tlskey, &tls_server, &tls_application ) == 0 );
1476 ok ( tlskey_cipher ( tlskey, &tls_server, key, sizeof ( key ),
1477 iv, sizeof ( iv ), mac, sizeof ( mac ) ) == 0 );
1479 key, sizeof ( key ) ) == 0 );
1481 iv, sizeof ( iv ) ) == 0 );
1483 mac, sizeof ( mac ) ) == 0 );
1484
1485 /* Save resumption secret */
1486 ok ( tlskey_save ( tlskey, NULL, 0, psk ) == 0 );
1487
1488 /* Stop key schedule */
1489 tlskey_stop ( tlskey );
1490
1491 /* Start key schedule */
1492 ok ( tlskey_start ( tlskey, &tlskey_md5_sha1, digest,
1493 &dummy_client_nonce ) == 0 );
1494 hkeys = tlskey->kdf.secret;
1495
1496 /* ClientHello */
1498 sizeof ( dummy_clienthello ) );
1499
1500 /* ServerHello */
1502 sizeof ( dummy_serverhello ) );
1503
1504 /* Load resumption secret */
1506 sizeof ( dummy_md5_sha1_master_secret_md5 ) ) != 0 );
1508 sizeof ( dummy_md5_sha1_master_secret_sha1 ) ) != 0 );
1509 ok ( tlskey_load ( tlskey, extended, psk ) == 0 );
1511 sizeof ( dummy_md5_sha1_master_secret_md5 ) ) == 0 );
1513 sizeof ( dummy_md5_sha1_master_secret_sha1 ) ) == 0 );
1514
1515 /* Stop key schedule */
1516 tlskey_stop ( tlskey );
1517}
1518
1519/**
1520 * Perform TLS key schedule self-test
1521 *
1522 */
1523static void tlskey_test_exec ( void ) {
1524 struct tls_key_schedule tlskey;
1525 struct tls_preshared_key psk;
1526
1527 /* Initialise data structures */
1528 memset ( &tlskey, 0, sizeof ( tlskey ) );
1529 memset ( &psk, 0, sizeof ( psk ) );
1530
1531 /* RFC 8448 simple 1-RTT test */
1532 rfc8448_simple_test ( &tlskey, &psk );
1533
1534 /* RFC 8448 resumed 0-RTT test */
1535 rfc8448_resumed_test ( &tlskey, &psk );
1536
1537 /* RFC 8448 HelloRetryRequest test */
1538 rfc8448_hrr_test ( &tlskey );
1539
1540 /* Dummy TLS version 1.2 test */
1541 dummy_hash ( &tlskey, &psk );
1542
1543 /* Dummy TLS version 1.0 test */
1544 dummy_md5_sha1 ( &tlskey, &psk );
1545}
1546
1547/** TLS key schedule self-test */
1548struct self_test tlskey_test __self_test = {
1549 .name = "tlskey",
1550 .exec = tlskey_test_exec,
1551};
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
union @162305117151260234136356364136041353210355154177 key
unsigned char uint8_t
Definition stdint.h:10
signed char int8_t
Definition stdint.h:15
uint8_t mac[ETH_ALEN]
MAC address.
Definition ena.h:13
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
static int exchange_agree(struct exchange_algorithm *exchange, const void *private, const void *partner, void *shared)
Definition crypto.h:403
String functions.
void * memset(void *dest, int character, size_t len) __nonnull
Dynamic memory allocation.
struct digest_algorithm md5_sha1_algorithm
Hybrid MD5+SHA1 digest algorithm.
Definition md5_sha1.c:87
Hybrid MD5+SHA1 hash as used by TLSv1.1 and earlier.
NIST P-256 elliptic curve.
struct exchange_algorithm p256_algorithm
uint32_t digestsize
Digest size (i.e.
Definition pccrr.h:1
SHA-256 algorithm.
struct digest_algorithm sha256_algorithm
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition string.c:115
A message digest algorithm.
Definition crypto.h:19
size_t digestsize
Digest size.
Definition crypto.h:27
A key exchange algorithm.
Definition crypto.h:210
size_t sharedsize
Shared secret size.
Definition crypto.h:218
An MD5+SHA1 HMAC key block.
Definition md5_sha1.h:57
uint8_t md5[MD5_BLOCK_SIZE]
MD5 HMAC key.
Definition md5_sha1.h:59
uint8_t sha1[SHA1_BLOCK_SIZE]
SHA-1 HMAC key.
Definition md5_sha1.h:61
A self-test set.
Definition test.h:15
TLS client state.
Definition tls.h:454
void * secret
Secret.
Definition tlskey.h:90
A TLS key schedule.
Definition tlskey.h:113
struct tls_traffic_secret traffic[2]
Traffic secrets.
Definition tlskey.h:137
struct tls_kdf_secret kdf
Key derivation function secret.
Definition tlskey.h:135
A TLS pre-shared key.
Definition tlskey.h:141
uint8_t resumption[48]
Resumption secret.
Definition tlskey.h:178
union tls_preshared_key::@022173016027117201055347232316162256252261104170 key
Key material.
TLS client or server random bytes.
Definition tlskey.h:36
TLS server state.
Definition tls.h:464
void * secret
Secret.
Definition tlskey.h:107
Self-test infrastructure.
#define ok(success)
Definition test.h:46
#define __self_test
Declare a self-test.
Definition test.h:32
int tlskey_save(struct tls_key_schedule *tlskey, const void *nonce, size_t nonce_len, struct tls_preshared_key *psk)
Save pre-shared key.
Definition tlskey.c:823
int tlskey_master(struct tls_key_schedule *tlskey, int ems)
Generate master secret.
Definition tlskey.c:585
int tlskey_cipher(struct tls_key_schedule *tlskey, const struct tls_endpoint *writer, void *key, size_t key_len, void *iv, size_t iv_len, void *mac, size_t mac_len)
Generate cipher key material.
Definition tlskey.c:719
int tlskey_load(struct tls_key_schedule *tlskey, int ems, const struct tls_preshared_key *psk)
Load pre-shared key.
Definition tlskey.c:866
void tlskey_stop(struct tls_key_schedule *tlskey)
Stop key schedule.
Definition tlskey.c:259
const struct tls_phase tls_early
Early traffic phase.
Definition tlskey.c:137
const struct tls_phase tls_handshake
Handshake traffic phase.
Definition tlskey.c:144
int tlskey_start(struct tls_key_schedule *tlskey, const struct tls_key_schedule_operations *op, struct digest_algorithm *digest, const struct tls_random *nonce)
Start key schedule.
Definition tlskey.c:180
int tlskey_tbshash(struct tls_key_schedule *tlskey, const struct tls_endpoint *end, struct digest_algorithm *digest, const void *data, size_t len, void *tbs)
Generate signable digest value.
Definition tlskey.c:772
int tlskey_apply(struct tls_key_schedule *tlskey, const void *shared, size_t shared_len)
Apply a new shared secret.
Definition tlskey.c:550
const struct tls_key_schedule_operations tlskey_hash
TLS key schedule based on P_Hash().
Definition tlskey.c:1868
int tlskey_traffic(struct tls_key_schedule *tlskey, const struct tls_endpoint *writer, const struct tls_phase *phase)
Generate traffic secret.
Definition tlskey.c:667
void tlskey_message(struct tls_key_schedule *tlskey)
Replace running transcript digest with a message hash of itself.
Definition tlskey.c:457
const struct tls_key_schedule_operations tlskey_md5_sha1
TLS key schedule based on P_MD5()+P_SHA1().
Definition tlskey.c:2097
int tlskey_verify(struct tls_key_schedule *tlskey, const struct tls_endpoint *end, void *verify, size_t verify_len)
Generate verification data.
Definition tlskey.c:630
void tlskey_digest(struct tls_key_schedule *tlskey, const void *data, size_t len)
Add handshake to running transcript digest.
Definition tlskey.c:416
const struct tls_phase tls_application
Application traffic phase.
Definition tlskey.c:151
int tlskey_bind(const struct tls_preshared_key *psk, const void *prefix, size_t prefix_len, void *binder, size_t binder_len)
Generate pre-shared key binder value.
Definition tlskey.c:923
const struct tls_key_schedule_operations tlskey_hkdf
TLS key schedule based on HKDF.
Definition tlskey.c:1407
TLS key schedules.
#define TLS_CLIENT
Client endpoint index.
Definition tlskey.h:27
#define TLS_SERVER
Server endpoint index.
Definition tlskey.h:30
static const uint8_t rfc8448_simple_client_handshake_traffic_key[]
RFC 8448 simple 1-RTT test: client handshake traffic key.
static const uint8_t rfc8448_hrr_client_handshake_traffic_secret[]
RFC 8448 HelloRetryRequest test: client handshake traffic secret.
static const uint8_t rfc8448_resumed_early_secret[]
RFC 8448 resumed 0-RTT test: early secret.
static const uint8_t rfc8448_resumed_endofearlydata[]
RFC 8448 resumed 0-RTT test: EndOfEarlyData.
static const uint8_t rfc8448_resumed_client_early_traffic_secret[]
RFC 8448 resumed 0-RTT test: client early traffic secret.
static const uint8_t rfc8448_simple_handshake_secret[]
RFC 8448 simple 1-RTT test: handshake secret.
static const uint8_t rfc8448_simple_client_application_traffic_key[]
RFC 8448 simple 1-RTT test: client application traffic key.
static const uint8_t rfc8448_simple_newsessionticket[]
RFC 8448 simple 1-RTT test: NewSessionTicket.
static const uint8_t rfc8448_resumed_handshake_secret[]
RFC 8448 resumed 0-RTT test: handshake secret.
static const uint8_t rfc8448_simple_encryptedextensions[]
RFC 8448 simple 1-RTT test: EncryptedExtensions.
static const uint8_t rfc8448_simple_server_handshake_traffic_iv[]
RFC 8448 simple 1-RTT test: server handshake traffic IV.
static const struct tls_random rfc8448_simple_client_nonce
RFC 8448 simple 1-RTT test: client random bytes.
Definition tlskey_test.c:55
static const uint8_t rfc8448_hrr_p256_partner[]
RFC 8448 HelloRetryRequest test: server P-256 public key.
static const uint8_t rfc8448_simple_x25519_private[]
RFC 8448 simple 1-RTT test: client X25519 private key.
Definition tlskey_test.c:65
static const uint8_t dummy_dh_param[]
Dummy minimal tests: ServerKeyExchange DH parameters.
static const uint8_t dummy_md5_sha1_master_secret_md5[]
Dummy minimal TLSv1.0 test: master secret (MD5 portion).
static const uint8_t dummy_md5_sha1_server_traffic_iv[]
Dummy minimal TLSv1.0 test: server traffic IV.
static const uint8_t rfc8448_simple_server_verify[]
RFC 8448 simple 1-RTT test: server verification.
static const uint8_t rfc8448_resumed_x25519_partner[]
RFC 8448 resumed 0-RTT test: server X25519 public key.
static const uint8_t dummy_hash_master_secret[]
Dummy minimal TLSv1.2 test: master secret.
static const uint8_t rfc8448_resumed_client_handshake_traffic_key[]
RFC 8448 resumed 0-RTT test: client handshake traffic key.
static const uint8_t dummy_serverhello[]
Dummy minimal tests: ServerHello.
static const struct tls_random dummy_client_nonce
Dummy minimal tests: client random bytes.
static const uint8_t rfc8448_simple_ticket_nonce[]
RFC 8448 simple 1-RTT test: ticket nonce.
Definition tlskey_test.c:79
static const uint8_t rfc8448_simple_client_verify[]
RFC 8448 simple 1-RTT test: client verification.
static const uint8_t dummy_hash_client_traffic_iv[]
Dummy minimal TLSv1.2 test: client traffic IV.
static void rfc8448_resumed_test(struct tls_key_schedule *tlskey, struct tls_preshared_key *psk)
Perform RFC 8448 resumed 0-RTT test.
static const uint8_t rfc8448_simple_client_application_traffic_secret[]
RFC 8448 simple 1-RTT test: client application traffic secret.
static const uint8_t rfc8448_resumed_client_application_traffic_iv[]
RFC 8448 resumed 0-RTT test: client application traffic IV.
static const uint8_t rfc8448_simple_client_application_traffic_iv[]
RFC 8448 simple 1-RTT test: client application traffic IV.
static const uint8_t dummy_hash_server_traffic_mac[]
Dummy minimal TLSv1.2 test: server traffic MAC.
static const uint8_t rfc8448_simple_serverhello[]
RFC 8448 simple 1-RTT test: ServerHello.
static const uint8_t rfc8448_simple_resumption[]
RFC 8448 simple 1-RTT test: resumption secret.
static const uint8_t rfc8448_simple_client_handshake_traffic_iv[]
RFC 8448 simple 1-RTT test: client handshake traffic IV.
static const uint8_t rfc8448_resumed_server_verify[]
RFC 8448 resumed 0-RTT test: server verification.
static const uint8_t rfc8448_hrr_serverhello2[]
RFC 8448 HelloRetryRequest test: server hello (second).
static const uint8_t rfc8448_resumed_server_application_traffic_key[]
RFC 8448 resumed 0-RTT test: server application traffic key.
static const uint8_t rfc8448_hrr_clienthello2[]
RFC 8448 HelloRetryRequest test: client hello (second).
static const uint8_t dummy_md5_sha1_master_secret_sha1[]
Dummy minimal TLSv1.0 test: master secret (SHA-1 portion).
static const uint8_t rfc8448_simple_early_secret[]
RFC 8448 simple 1-RTT test: early secret.
static const uint8_t rfc8448_hrr_serverhello1[]
RFC 8448 HelloRetryRequest test: server hello (first).
static const uint8_t rfc8448_resumed_client_early_traffic_iv[]
RFC 8448 resumed 0-RTT test: client early traffic IV.
static const uint8_t dummy_md5_sha1_client_traffic_mac[]
Dummy minimal TLSv1.0 test: client traffic MAC.
static const uint8_t dummy_hash_client_tbshash[]
Dummy minimal TLSv1.2 test: client signable digest.
static const uint8_t dummy_hash_client_verify[]
Dummy minimal TLSv1.2 test: client verification.
static const uint8_t dummy_md5_sha1_client_traffic_key[]
Dummy minimal TLSv1.0 test: client traffic key.
static const uint8_t rfc8448_simple_server_tbshash[]
RFC 8448 simple 1-RTT test: server CertificateVerify signable digest.
static const uint8_t rfc8448_hrr_clienthello1[]
RFC 8448 HelloRetryRequest test: client hello (first).
static const uint8_t rfc8448_resumed_server_application_traffic_iv[]
RFC 8448 resumed 0-RTT test: server application traffic IV.
static const uint8_t dummy_hash_server_tbshash[]
Dummy minimal TLSv1.2 test: server signable digest.
static const uint8_t rfc8448_simple_certificateverify[]
RFC 8448 simple 1-RTT test: CertificateVerify.
static const uint8_t rfc8448_resumed_server_handshake_traffic_key[]
RFC 8448 resumed 0-RTT test: server handshake traffic key.
static const uint8_t rfc8448_resumed_client_application_traffic_secret[]
RFC 8448 resumed 0-RTT test: client application traffic secret.
static const uint8_t dummy_hash_server_traffic_iv[]
Dummy minimal TLSv1.2 test: server traffic IV.
static const uint8_t rfc8448_simple_client_handshake_traffic_secret[]
RFC 8448 simple 1-RTT test: client handshake traffic secret.
static const uint8_t rfc8448_resumed_server_finished[]
RFC 8448 resumed 0-RTT test: server Finished.
static const uint8_t dummy_md5_sha1_server_traffic_key[]
Dummy minimal TLSv1.0 test: server traffic key.
static const uint8_t rfc8448_resumed_client_verify[]
RFC 8448 resumed 0-RTT test: client verification.
static void tlskey_test_exec(void)
Perform TLS key schedule self-test.
static const uint8_t rfc8448_simple_x25519_partner[]
RFC 8448 simple 1-RTT test: server X25519 public key.
Definition tlskey_test.c:72
static void rfc8448_hrr_test(struct tls_key_schedule *tlskey)
Perform RFC 8448 HelloRetryRequest test.
static const uint8_t rfc8448_hrr_server_handshake_traffic_secret[]
RFC 8448 HelloRetryRequest test: server handshake traffic secret.
static const uint8_t rfc8448_simple_clienthello[]
RFC 8448 simple 1-RTT test: ClientHello.
Definition tlskey_test.c:82
static const struct tls_random rfc8448_resumed_server_nonce
RFC 8448 resumed 0-RTT test: server random bytes.
static const uint8_t rfc8448_simple_master_secret[]
RFC 8448 simple 1-RTT test: master secret.
static const uint8_t rfc8448_resumed_client_early_traffic_key[]
RFC 8448 resumed 0-RTT test: client early traffic key.
static const uint8_t dummy_md5_sha1_server_traffic_mac[]
Dummy minimal TLSv1.0 test: server traffic MAC.
static void rfc8448_simple_test(struct tls_key_schedule *tlskey, struct tls_preshared_key *psk)
Perform RFC 8448 simple 1-RTT test.
static const uint8_t rfc8448_resumed_client_application_traffic_key[]
RFC 8448 resumed 0-RTT test: client application traffic key.
static const uint8_t rfc8448_simple_client_finished[]
RFC 8448 simple 1-RTT test: client Finished.
static const uint8_t rfc8448_simple_server_handshake_traffic_secret[]
RFC 8448 simple 1-RTT test: server handshake traffic secret.
static const uint8_t dummy_md5_sha1_server_verify[]
Dummy minimal TLSv1.0 test: server verification.
static const struct tls_random rfc8448_hrr_client_nonce
RFC 8448 HelloRetryRequest test: client random bytes.
static const uint8_t dummy_md5_sha1_client_traffic_iv[]
Dummy minimal TLSv1.0 test: client traffic IV.
static const uint8_t dummy_md5_sha1_client_verify[]
Dummy minimal TLSv1.0 test: client verification.
static const uint8_t rfc8448_simple_server_application_traffic_iv[]
RFC 8448 simple 1-RTT test: server application traffic IV.
static const uint8_t rfc8448_simple_server_application_traffic_key[]
RFC 8448 simple 1-RTT test: server application traffic key.
static const uint8_t rfc8448_resumed_encryptedextensions[]
RFC 8448 resumed 0-RTT test: EncryptedExtensions.
static const uint8_t rfc8448_resumed_client_finished[]
RFC 8448 resumed 0-RTT test: client Finished.
static const uint8_t rfc8448_resumed_client_handshake_traffic_secret[]
RFC 8448 resumed 0-RTT test: client handshake traffic secret.
static const uint8_t rfc8448_simple_certificate[]
RFC 8448 simple 1-RTT test: Certificate.
static const uint8_t rfc8448_hrr_handshake_secret[]
RFC 8448 HelloRetryRequest test: handshake secret.
static const uint8_t rfc8448_simple_server_handshake_traffic_key[]
RFC 8448 simple 1-RTT test: server handshake traffic key.
static const uint8_t rfc8448_resumed_master_secret[]
RFC 8448 resumed 0-RTT test: master secret.
static const uint8_t rfc8448_resumed_server_handshake_traffic_iv[]
RFC 8448 resumed 0-RTT test: server handshake traffic IV.
static void dummy_md5_sha1(struct tls_key_schedule *tlskey, struct tls_preshared_key *psk)
Perform dummy TLS version 1.0 test.
static const uint8_t dummy_clienthello[]
Dummy minimal tests: ClientHello.
static const uint8_t dummy_premaster[]
Dummy minimal tests: pre-master secret.
static void dummy_hash(struct tls_key_schedule *tlskey, struct tls_preshared_key *psk)
Perform dummy TLS version 1.2 test.
static const uint8_t dummy_hash_server_traffic_key[]
Dummy minimal TLSv1.2 test: server traffic key.
static const uint8_t rfc8448_hrr_p256_private[]
RFC 8448 HelloRetryRequest test: client P-256 private key.
static const uint8_t rfc8448_resumed_serverhello[]
RFC 8448 resumed 0-RTT test: ServerHello.
static const uint8_t rfc8448_simple_server_finished[]
RFC 8448 simple 1-RTT test: server Finished.
static const uint8_t rfc8448_resumed_psk_binder[]
RFC 8448 resumed 0-RTT test: PSK binder.
static const uint8_t dummy_hash_client_traffic_mac[]
Dummy minimal TLSv1.2 test: client traffic MAC.
static const uint8_t rfc8448_simple_server_application_traffic_secret[]
RFC 8448 simple 1-RTT test: server application traffic secret.
static const uint8_t rfc8448_resumed_client_handshake_traffic_iv[]
RFC 8448 resumed 0-RTT test: client handshake traffic IV.
static const size_t rfc8448_resumed_clienthello_prefix_len
RFC 8448 resumed 0-RTT test: ClientHello prefix length.
static const uint8_t dummy_hash_server_verify[]
Dummy minimal TLSv1.2 test: server verification.
static const uint8_t dummy_hash_client_traffic_key[]
Dummy minimal TLSv1.2 test: client traffic key.
static const uint8_t rfc8448_resumed_server_handshake_traffic_secret[]
RFC 8448 resumed 0-RTT test: server handshake traffic secret.
static const uint8_t rfc8448_resumed_clienthello[]
RFC 8448 resumed 0-RTT test: ClientHello.
static const uint8_t rfc8448_resumed_server_application_traffic_secret[]
RFC 8448 resumed 0-RTT test: server application traffic secret.
static const uint8_t rfc8448_resumed_x25519_private[]
RFC 8448 resumed 0-RTT test: client X25519 private key.
u8 iv[16]
Initialization vector.
Definition wpa.h:33
struct exchange_algorithm x25519_algorithm
X25519 key exchange algorithm.
Definition x25519.c:875
X25519 key exchange.