1 /* mbedTLS AES test
2 */
3 #include <string.h>
4 #include <stdio.h>
5 #include <stdbool.h>
6 #include <esp_system.h>
7 #include "mbedtls/aes.h"
8 #include "mbedtls/gcm.h"
9 #include "unity.h"
10 #include "sdkconfig.h"
11 #include "esp_log.h"
12 #include "esp_timer.h"
13 #include "esp_heap_caps.h"
14 #include "test_utils.h"
15
16 static const uint8_t key_256[] = {
17 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
18 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
19 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
20 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
21 };
22
23 static const uint8_t iv[] = {
24 0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09,
25 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
26 };
27
28 /* Cipher produced via this Python:
29 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
30 from cryptography.hazmat.backends import default_backend
31
32 def as_c_array(byte_arr):
33
34 hex_str = ''
35 for idx, byte in enumerate(byte_arr):
36 hex_str += "0x{:02x}, ".format(byte)
37 bytes_per_line = 8
38 if idx % bytes_per_line == bytes_per_line - 1:
39 hex_str += '\n'
40
41 return hex_str
42
43 key = bytearray(range(32))
44 iv = bytearray(range(16, 0, -1))
45
46 print("Key: \n{}".format(as_c_array(key)))
47 print("IV: \n{}".format(as_c_array(iv)))
48
49 # Replace CTR with desired mode
50 cipher = Cipher(algorithms.AES(key), modes.CTR(iv), backend=default_backend())
51 encryptor = cipher.encryptor()
52
53 input_len = 1000
54
55 plain = b'\x3A'*input_len
56 print(as_c_array(plain))
57 ct = encryptor.update(plain) + encryptor.finalize()
58
59 print("Chipertext: {}".format(as_c_array(ct)))
60 */
61 TEST_CASE("mbedtls CBC AES-256 test", "[aes]")
62 {
63 const unsigned SZ = 1600;
64 mbedtls_aes_context ctx;
65 uint8_t nonce[16];
66
67 const uint8_t expected_cipher_end[] = {
68 0x3e, 0x68, 0x8a, 0x02, 0xe6, 0xf2, 0x6a, 0x9e,
69 0x9b, 0xb2, 0xc0, 0xc4, 0x63, 0x63, 0xd9, 0x25,
70 0x51, 0xdc, 0xc2, 0x71, 0x96, 0xb3, 0xe5, 0xcd,
71 0xbd, 0x0e, 0xf2, 0xef, 0xa9, 0xab, 0xab, 0x2d,
72 };
73
74 memcpy(nonce, iv, 16);
75
76 // allocate internal memory
77 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
78 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
79 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
80
81 TEST_ASSERT_NOT_NULL(chipertext);
82 TEST_ASSERT_NOT_NULL(plaintext);
83 TEST_ASSERT_NOT_NULL(decryptedtext);
84
85 mbedtls_aes_init(&ctx);
86 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
87
88 memset(plaintext, 0x3A, SZ);
89 memset(decryptedtext, 0x0, SZ);
90
91 // Encrypt
92 mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, SZ, nonce, plaintext, chipertext);
93 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, chipertext + SZ - 32, 32);
94
95 // Decrypt
96 memcpy(nonce, iv, 16);
97 mbedtls_aes_setkey_dec(&ctx, key_256, 256);
98 mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, SZ, nonce, chipertext, decryptedtext);
99
100 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
101
102 mbedtls_aes_free(&ctx);
103 free(plaintext);
104 free(chipertext);
105 free(decryptedtext);
106 }
107
108 TEST_CASE("mbedtls CTR AES-256 test", "[aes]")
109 {
110 const unsigned SZ = 1000;
111 mbedtls_aes_context ctx;
112 uint8_t nonce[16];
113 uint8_t stream_block[16];
114 size_t nc_off = 0;
115
116 const uint8_t expected_cipher_end[] = {
117 0xd4, 0xdc, 0x4f, 0x8f, 0xfe, 0x86, 0xee, 0xb5,
118 0x14, 0x7f, 0xba, 0x30, 0x25, 0xa6, 0x7f, 0x6c,
119 0xb5, 0x73, 0xaf, 0x90, 0xd7, 0xff, 0x36, 0xba,
120 0x2b, 0x1d, 0xec, 0xb9, 0x38, 0xfa, 0x0d, 0xeb,
121 };
122
123 memcpy(nonce, iv, 16);
124
125 // allocate internal memory
126 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
127 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
128 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
129
130 TEST_ASSERT_NOT_NULL(chipertext);
131 TEST_ASSERT_NOT_NULL(plaintext);
132 TEST_ASSERT_NOT_NULL(decryptedtext);
133
134 mbedtls_aes_init(&ctx);
135 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
136
137 memset(plaintext, 0x3A, SZ);
138 memset(decryptedtext, 0x0, SZ);
139
140 // Encrypt
141 mbedtls_aes_crypt_ctr(&ctx, SZ, &nc_off, nonce, stream_block, plaintext, chipertext);
142 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, chipertext + SZ - 32, 32);
143
144 // Decrypt
145 nc_off = 0;
146 memcpy(nonce, iv, 16);
147 mbedtls_aes_crypt_ctr(&ctx, SZ, &nc_off, nonce, stream_block, chipertext, decryptedtext);
148
149 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
150
151 mbedtls_aes_free(&ctx);
152 free(plaintext);
153 free(chipertext);
154 free(decryptedtext);
155 }
156
157 TEST_CASE("mbedtls OFB AES-256 test", "[aes]")
158 {
159 const unsigned SZ = 1000;
160 mbedtls_aes_context ctx;
161 uint8_t nonce[16];
162 size_t nc_off = 0;
163
164 const uint8_t expected_cipher_end[] = {
165 0xca, 0xc3, 0x05, 0x77, 0xae, 0xb9, 0x38, 0xd6,
166 0x03, 0x0a, 0xad, 0x90, 0x6e, 0xdd, 0xf3, 0x9a,
167 0x41, 0x4d, 0x71, 0x30, 0x04, 0x9f, 0xd3, 0x53,
168 0xb7, 0x5e, 0xb4, 0xfd, 0x93, 0xf8, 0x31, 0x6a,
169 };
170
171 memcpy(nonce, iv, 16);
172
173 // allocate internal memory
174 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
175 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
176 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
177
178 TEST_ASSERT_NOT_NULL(chipertext);
179 TEST_ASSERT_NOT_NULL(plaintext);
180 TEST_ASSERT_NOT_NULL(decryptedtext);
181
182 mbedtls_aes_init(&ctx);
183 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
184
185 memset(plaintext, 0x3A, SZ);
186 memset(decryptedtext, 0x0, SZ);
187
188 // Encrypt
189 mbedtls_aes_crypt_ofb(&ctx, SZ, &nc_off, nonce, plaintext, chipertext);
190 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, chipertext + SZ - 32, 32);
191
192 // Decrypt
193 nc_off = 0;
194 memcpy(nonce, iv, 16);
195 mbedtls_aes_crypt_ofb(&ctx, SZ, &nc_off, nonce, chipertext, decryptedtext);
196
197 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
198
199 mbedtls_aes_free(&ctx);
200 free(plaintext);
201 free(chipertext);
202 free(decryptedtext);
203 }
204
205 TEST_CASE("mbedtls CFB-8 AES-256 test", "[aes]")
206 {
207 const unsigned SZ = 1000;
208 mbedtls_aes_context ctx;
209 uint8_t nonce[16];
210
211 const uint8_t expected_cipher_end[] = {
212 0x69, 0xdc, 0x1d, 0x8a, 0x0b, 0x9e, 0xbc, 0x84,
213 0x29, 0xa2, 0x04, 0xb6, 0x91, 0x6b, 0xb2, 0x83,
214 0x13, 0x23, 0x54, 0xcb, 0xf9, 0x6d, 0xcc, 0x53,
215 0x04, 0x59, 0xd1, 0xc9, 0xff, 0xab, 0xe2, 0x37,
216 };
217
218 memcpy(nonce, iv, 16);
219
220 // allocate internal memory
221 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
222 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
223 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
224
225 TEST_ASSERT_NOT_NULL(chipertext);
226 TEST_ASSERT_NOT_NULL(plaintext);
227 TEST_ASSERT_NOT_NULL(decryptedtext);
228
229 mbedtls_aes_init(&ctx);
230 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
231
232 memset(plaintext, 0x3A, SZ);
233 memset(decryptedtext, 0x0, SZ);
234
235 // Encrypt
236 mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_ENCRYPT, SZ, nonce, plaintext, chipertext);
237 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, chipertext + SZ - 32, 32);
238
239 // Decrypt
240 memcpy(nonce, iv, 16);
241 mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_DECRYPT, SZ, nonce, chipertext, decryptedtext);
242
243 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
244
245 mbedtls_aes_free(&ctx);
246 free(plaintext);
247 free(chipertext);
248 free(decryptedtext);
249 }
250
251 TEST_CASE("mbedtls CFB-128 AES-256 test", "[aes]")
252 {
253 const unsigned SZ = 1000;
254 mbedtls_aes_context ctx;
255 uint8_t nonce[16];
256 size_t nc_off = 0;
257
258 const uint8_t expected_cipher_end[] = {
259 0xf3, 0x64, 0x20, 0xa1, 0x70, 0x2a, 0xd9, 0x3f,
260 0xb7, 0x48, 0x8c, 0x2c, 0x1f, 0x65, 0x53, 0xc2,
261 0xac, 0xfd, 0x82, 0xe5, 0x31, 0x24, 0x1f, 0x30,
262 0xaf, 0xcc, 0x8d, 0xb3, 0xf3, 0x63, 0xe1, 0xa0,
263 };
264
265 memcpy(nonce, iv, 16);
266
267 // allocate internal memory
268 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
269 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
270 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
271
272 TEST_ASSERT_NOT_NULL(chipertext);
273 TEST_ASSERT_NOT_NULL(plaintext);
274 TEST_ASSERT_NOT_NULL(decryptedtext);
275
276 mbedtls_aes_init(&ctx);
277 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
278
279 memset(plaintext, 0x3A, SZ);
280 memset(decryptedtext, 0x0, SZ);
281
282 // Encrypt
283 mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_ENCRYPT, SZ, &nc_off, nonce, plaintext, chipertext);
284 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, chipertext + SZ - 32, 32);
285
286 // Decrypt
287 nc_off = 0;
288 memcpy(nonce, iv, 16);
289 mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_DECRYPT, SZ, &nc_off, nonce, chipertext, decryptedtext);
290
291 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
292
293 mbedtls_aes_free(&ctx);
294 free(plaintext);
295 free(chipertext);
296 free(decryptedtext);
297 }
298
299 TEST_CASE("mbedtls CTR stream test", "[aes]")
300 {
301 const unsigned SZ = 100;
302 mbedtls_aes_context ctx;
303 uint8_t nonce[16];
304 uint8_t key[16];
305 uint8_t stream_block[16];
306
307 /* Cipher produced via this Python:
308 import os, binascii
309 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
310 from cryptography.hazmat.backends import default_backend
311 key = b'\x44' * 16
312 nonce = b'\xee' * 16
313 cipher = Cipher(algorithms.AES(key), modes.CTR(nonce), backend=default_backend())
314 encryptor = cipher.encryptor()
315 ct = encryptor.update(b'\xaa' * 100) + encryptor.finalize()
316 ct_arr = ""
317 for idx, b in enumerate(ct):
318 if idx % 8 == 0:
319 ct_arr += '\n'
320 ct_arr += "0x{}, ".format(binascii.hexlify(b))
321 print(ct_arr)
322 */
323 const uint8_t expected_cipher[] = {
324 0xc5, 0x78, 0xa7, 0xb4, 0xf3, 0xb9, 0xcb, 0x8b,
325 0x09, 0xe0, 0xd6, 0x89, 0x14, 0x6a, 0x19, 0x09,
326 0xde, 0xaf, 0x37, 0x19, 0x32, 0x4d, 0xca, 0xf6,
327 0xff, 0x6e, 0xd2, 0x5d, 0x87, 0x51, 0xaa, 0x8c,
328 0x1c, 0xe3, 0x3b, 0xbb, 0x18, 0xf5, 0xa0, 0x1b,
329 0xdc, 0x29, 0x52, 0x63, 0xf6, 0x5d, 0x49, 0x85,
330 0x29, 0xf1, 0xf0, 0x69, 0x8f, 0xa6, 0x9f, 0x38,
331 0x5c, 0xdd, 0x26, 0xf8, 0x9d, 0x40, 0xa1, 0xff,
332 0x52, 0x46, 0xe1, 0x72, 0x70, 0x39, 0x73, 0xff,
333 0xd0, 0x5e, 0xe5, 0x3f, 0xc5, 0xed, 0x5c, 0x18,
334 0xa7, 0x84, 0xd8, 0xdf, 0x9d, 0xb5, 0x06, 0xb1,
335 0xa7, 0xcf, 0x2e, 0x7a, 0x51, 0xfc, 0x44, 0xc5,
336 0xb9, 0x5f, 0x22, 0x47,
337 };
338
339
340 memset(nonce, 0xEE, 16);
341 memset(key, 0x44, 16);
342
343 // allocate internal memory
344 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
345 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
346 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
347
348 TEST_ASSERT_NOT_NULL(chipertext);
349 TEST_ASSERT_NOT_NULL(plaintext);
350 TEST_ASSERT_NOT_NULL(decryptedtext);
351
352 mbedtls_aes_init(&ctx);
353 mbedtls_aes_setkey_enc(&ctx, key, 128);
354 memset(plaintext, 0xAA, SZ);
355
356 /* Test that all the end results are the same
357 no matter how many bytes we encrypt each call
358 */
359 for (int bytes_to_process = 1; bytes_to_process < SZ; bytes_to_process++) {
360 ESP_LOGD("test", "bytes_to_process %d", bytes_to_process);
361 memset(nonce, 0xEE, 16);
362 memset(chipertext, 0x0, SZ);
363 memset(decryptedtext, 0x0, SZ);
364
365 size_t offset = 0;
366 // Encrypt
367 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
368 // Limit length of last call to avoid exceeding buffer size
369 size_t length = (idx + bytes_to_process > SZ) ? (SZ - idx) : bytes_to_process;
370
371 mbedtls_aes_crypt_ctr(&ctx, length, &offset, nonce,
372 stream_block, plaintext + idx, chipertext + idx );
373 }
374 ESP_LOG_BUFFER_HEXDUMP("expected", expected_cipher, SZ, ESP_LOG_DEBUG);
375 ESP_LOG_BUFFER_HEXDUMP("actual ", chipertext, SZ, ESP_LOG_DEBUG);
376
377 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher, chipertext, SZ);
378
379 // Decrypt
380 memset(nonce, 0xEE, 16);
381 memset(decryptedtext, 0x22, SZ);
382 offset = 0;
383 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
384 // Limit length of last call to avoid exceeding buffer size
385 size_t length = (idx + bytes_to_process > SZ) ? (SZ - idx) : bytes_to_process;
386 mbedtls_aes_crypt_ctr(&ctx, length, &offset, nonce,
387 stream_block, chipertext + idx, decryptedtext + idx );
388 }
389 ESP_LOG_BUFFER_HEXDUMP("decrypted", decryptedtext, SZ, ESP_LOG_DEBUG);
390 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
391 }
392
393 mbedtls_aes_free(&ctx);
394 free(plaintext);
395 free(chipertext);
396 free(decryptedtext);
397 }
398
399
400 TEST_CASE("mbedtls OFB stream test", "[aes]")
401 {
402 const unsigned SZ = 100;
403 mbedtls_aes_context ctx;
404 uint8_t iv[16];
405 uint8_t key[16];
406
407 /* Cipher produced via this Python:
408 import os, binascii
409 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
410 from cryptography.hazmat.backends import default_backend
411 key = b'\x44' * 16
412 iv = b'\xee' * 16
413 cipher = Cipher(algorithms.AES(key), modes.OFB(iv), backend=default_backend())
414 encryptor = cipher.encryptor()
415 ct = encryptor.update(b'\xaa' * 100) + encryptor.finalize()
416 ct_arr = ""
417 for idx, b in enumerate(ct):
418 if idx % 8 == 0:
419 ct_arr += '\n'
420 ct_arr += "0x{}, ".format(binascii.hexlify(b))
421 print(ct_arr)
422 */
423 const uint8_t expected_cipher[] = {
424 0xc5, 0x78, 0xa7, 0xb4, 0xf3, 0xb9, 0xcb, 0x8b,
425 0x09, 0xe0, 0xd6, 0x89, 0x14, 0x6a, 0x19, 0x09,
426 0x0a, 0x33, 0x8b, 0xab, 0x82, 0xcb, 0x20, 0x8f,
427 0x74, 0x2a, 0x6c, 0xb3, 0xc6, 0xe8, 0x18, 0x89,
428 0x09, 0xb6, 0xaf, 0x20, 0xcd, 0xea, 0x74, 0x14,
429 0x48, 0x61, 0xe8, 0x4d, 0x50, 0x12, 0x9f, 0x5e,
430 0xb8, 0x10, 0x53, 0x3b, 0x74, 0xd9, 0xd0, 0x95,
431 0x13, 0xdc, 0x14, 0xcf, 0x0c, 0xa1, 0x90, 0xfd,
432 0xa2, 0x58, 0x12, 0xb2, 0x00, 0x2c, 0x5b, 0x7a,
433 0x2a, 0x76, 0x80, 0x20, 0x82, 0x39, 0xa2, 0x21,
434 0xf8, 0x7a, 0xec, 0xae, 0x82, 0x6a, 0x5c, 0xd3,
435 0x04, 0xd9, 0xbd, 0xe4, 0x53, 0xc9, 0xdf, 0x67,
436 0xaa, 0x5c, 0xaf, 0xa6,
437 };
438
439
440 memset(key, 0x44, 16);
441
442 // allocate internal memory
443 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
444 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
445 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
446
447 TEST_ASSERT_NOT_NULL(chipertext);
448 TEST_ASSERT_NOT_NULL(plaintext);
449 TEST_ASSERT_NOT_NULL(decryptedtext);
450
451 mbedtls_aes_init(&ctx);
452 mbedtls_aes_setkey_enc(&ctx, key, 128);
453 memset(plaintext, 0xAA, SZ);
454
455 /* Test that all the end results are the same
456 no matter how many bytes we encrypt each call
457 */
458
459 for (int bytes_to_process = 1; bytes_to_process < SZ; bytes_to_process++) {
460 ESP_LOGD("test", "bytes_to_process %d", bytes_to_process);
461 // Encrypt
462 memset(iv, 0xEE, 16);
463 size_t offset = 0;
464 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
465 // Limit length of last call to avoid exceeding buffer size
466 size_t length = ( (idx + bytes_to_process) > SZ) ? (SZ - idx) : bytes_to_process;
467 mbedtls_aes_crypt_ofb(&ctx, length, &offset, iv, plaintext + idx, chipertext + idx);
468
469 }
470 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher, chipertext, SZ);
471
472 // Decrypt
473 memset(iv, 0xEE, 16);
474 memset(decryptedtext, 0x22, SZ);
475 offset = 0;
476 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
477 // Limit length of last call to avoid exceeding buffer size
478 size_t length = (idx + bytes_to_process > SZ) ? (SZ - idx) : bytes_to_process;
479 mbedtls_aes_crypt_ofb(&ctx, length, &offset, iv, chipertext + idx, decryptedtext + idx);
480 }
481 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
482 }
483
484 mbedtls_aes_free(&ctx);
485 free(plaintext);
486 free(chipertext);
487 free(decryptedtext);
488 }
489
490 TEST_CASE("mbedtls CFB8 stream test", "[aes]")
491 {
492 const unsigned SZ = 32;
493 mbedtls_aes_context ctx;
494 uint8_t iv[16];
495 uint8_t key[16];
496
497 /* Cipher produced via this Python:
498 import os, binascii
499 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
500 from cryptography.hazmat.backends import default_backend
501 key = b'\x44' * 16
502 iv = b'\xee' * 16
503 cipher = Cipher(algorithms.AES(key), modes.CFB8(iv), backend=default_backend())
504 encryptor = cipher.encryptor()
505 ct = encryptor.update(b'\xaa' * 100) + encryptor.finalize()
506 ct_arr = ""
507 for idx, b in enumerate(ct):
508 if idx % 8 == 0:
509 ct_arr += '\n'
510 ct_arr += "0x{}, ".format(binascii.hexlify(b))
511 print(ct_arr)
512 */
513 const uint8_t expected_cipher[] = {
514 0xc5, 0x2f, 0xb0, 0x9b, 0x94, 0x9c, 0xa4, 0x5c,
515 0x0f, 0x4d, 0xa1, 0x9d, 0xd1, 0x19, 0xfc, 0x04,
516 0xe2, 0x7f, 0x04, 0x82, 0x6a, 0xa3, 0x61, 0xbb,
517 0x07, 0x6f, 0xac, 0xb9, 0xdf, 0x00, 0xf9, 0xa8,
518 0xc4, 0xbe, 0x9d, 0x4d, 0xd9, 0x42, 0x8a, 0x83,
519 0x12, 0x8b, 0xeb, 0xd7, 0x88, 0x70, 0x8a, 0xed,
520 0x46, 0x81, 0x5b, 0x4c, 0x14, 0x67, 0xe0, 0xfb,
521 0xab, 0x34, 0x90, 0x85, 0x24, 0xd2, 0x6b, 0x64,
522 0xdf, 0x1d, 0x04, 0xfd, 0x69, 0xf6, 0x30, 0xbe,
523 0xa6, 0xac, 0x0b, 0x54, 0x25, 0x24, 0x67, 0xd6,
524 0x09, 0xb1, 0x8f, 0x91, 0x63, 0xbd, 0xdf, 0xa1,
525 0x8a, 0xa3, 0x2e, 0xeb, 0x15, 0x7d, 0xe5, 0x37,
526 0xe5, 0x5a, 0x9f, 0xa5,
527 };
528
529
530 memset(key, 0x44, 16);
531
532 // allocate internal memory
533 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
534 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
535 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
536
537 TEST_ASSERT_NOT_NULL(chipertext);
538 TEST_ASSERT_NOT_NULL(plaintext);
539 TEST_ASSERT_NOT_NULL(decryptedtext);
540
541 mbedtls_aes_init(&ctx);
542 mbedtls_aes_setkey_enc(&ctx, key, 128);
543 memset(plaintext, 0xAA, SZ);
544
545 /* Test that all the end results are the same
546 no matter how many bytes we encrypt each call
547 */
548
549 for (int bytes_to_process = 1; bytes_to_process < SZ; bytes_to_process++) {
550 memset(iv, 0xEE, 16);
551 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
552 // Limit length of last call to avoid exceeding buffer size
553 size_t length = ( (idx + bytes_to_process) > SZ) ? (SZ - idx) : bytes_to_process;
554 mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_ENCRYPT, length, iv, plaintext + idx, chipertext + idx);
555
556 }
557 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher, chipertext, SZ);
558
559 memset(iv, 0xEE, 16);
560 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
561 // Limit length of last call to avoid exceeding buffer size
562 size_t length = ( (idx + bytes_to_process) > SZ) ? (SZ - idx) : bytes_to_process;
563 mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_DECRYPT, length, iv, chipertext + idx, decryptedtext + idx);
564
565 }
566 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
567 }
568
569 mbedtls_aes_free(&ctx);
570 free(plaintext);
571 free(chipertext);
572 free(decryptedtext);
573 }
574
575 TEST_CASE("mbedtls CFB128 stream test", "[aes]")
576 {
577 const unsigned SZ = 32;
578 mbedtls_aes_context ctx;
579 uint8_t iv[16];
580 uint8_t key[16];
581
582 /* Cipher produced via this Python:
583 import os, binascii
584 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
585 from cryptography.hazmat.backends import default_backend
586 key = b'\x44' * 16
587 iv = b'\xee' * 16
588 cipher = Cipher(algorithms.AES(key), modes.CFB(iv), backend=default_backend())
589 encryptor = cipher.encryptor()
590 ct = encryptor.update(b'\xaa' * 100) + encryptor.finalize()
591 ct_arr = ""
592 for idx, b in enumerate(ct):
593 if idx % 8 == 0:
594 ct_arr += '\n'
595 ct_arr += "0x{}, ".format(binascii.hexlify(b))
596 print(ct_arr)
597 */
598 const uint8_t expected_cipher[] = {
599 0xc5, 0x78, 0xa7, 0xb4, 0xf3, 0xb9, 0xcb, 0x8b,
600 0x09, 0xe0, 0xd6, 0x89, 0x14, 0x6a, 0x19, 0x09,
601 0xf9, 0x08, 0x7e, 0xe1, 0x92, 0x8a, 0x7c, 0xa4,
602 0x25, 0xa5, 0xa7, 0x43, 0x24, 0x8d, 0x85, 0x3e,
603 0x99, 0x28, 0xeb, 0x36, 0x59, 0x74, 0x69, 0x0e,
604 0x09, 0x9f, 0x4e, 0xc0, 0x6d, 0xc3, 0x2b, 0x80,
605 0x01, 0xad, 0xa1, 0x0c, 0x99, 0x90, 0x8b, 0x07,
606 0xd6, 0x00, 0xf0, 0x32, 0xd7, 0x6b, 0xa1, 0xf1,
607 0x4d, 0x14, 0xd0, 0x28, 0xde, 0x64, 0x23, 0x71,
608 0xf4, 0x23, 0x61, 0x12, 0x71, 0xbe, 0x03, 0x74,
609 0x99, 0x81, 0x9d, 0x65, 0x48, 0xd9, 0xd4, 0x67,
610 0xd1, 0x31, 0xe8, 0x44, 0x27, 0x17, 0xd4, 0x2d,
611 0x3d, 0x59, 0xf7, 0xd3,
612 };
613
614
615 memset(key, 0x44, 16);
616
617 // allocate internal memory
618 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
619 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
620 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
621
622 TEST_ASSERT_NOT_NULL(chipertext);
623 TEST_ASSERT_NOT_NULL(plaintext);
624 TEST_ASSERT_NOT_NULL(decryptedtext);
625
626 mbedtls_aes_init(&ctx);
627 mbedtls_aes_setkey_enc(&ctx, key, 128);
628 memset(plaintext, 0xAA, SZ);
629
630 /* Test that all the end results are the same
631 no matter how many bytes we encrypt each call
632 */
633
634 //for (int bytes_to_process = 1; bytes_to_process < SZ; bytes_to_process++) {
635 int bytes_to_process = 17;
636 size_t offset = 0;
637 memset(iv, 0xEE, 16);
638 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
639 // Limit length of last call to avoid exceeding buffer size
640 size_t length = ( (idx + bytes_to_process) > SZ) ? (SZ - idx) : bytes_to_process;
641 mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_ENCRYPT, length, &offset, iv, plaintext + idx, chipertext + idx);
642
643 }
644 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher, chipertext, SZ);
645
646 offset = 0;
647 memset(iv, 0xEE, 16);
648 for (int idx = 0; idx < SZ; idx = idx + bytes_to_process) {
649 // Limit length of last call to avoid exceeding buffer size
650 size_t length = ( (idx + bytes_to_process) > SZ) ? (SZ - idx) : bytes_to_process;
651 mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_DECRYPT, length, &offset, iv, chipertext + idx, decryptedtext + idx);
652
653 }
654 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
655
656 mbedtls_aes_free(&ctx);
657 free(plaintext);
658 free(chipertext);
659 free(decryptedtext);
660 }
661
662 /* Cipher produced via this Python:
663 import os, binascii
664 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
665 from cryptography.hazmat.backends import default_backend
666 key = b'\x44' * 16
667 nonce = b'\xee' * 16
668 cipher = Cipher(algorithms.AES(key), modes.CTR(nonce), backend=default_backend())
669 encryptor = cipher.encryptor()
670 ct = encryptor.update(b'\xaa' * 100) + encryptor.finalize()
671 ct_arr = ""
672 for idx, b in enumerate(ct):
673 if idx % 8 == 0:
674 ct_arr += '\n'
675 ct_arr += "0x{}, ".format(binascii.hexlify(b))
676 print(ct_arr)
677 */
678
679 /* Test the case where the input and output buffers point to the same location */
680 TEST_CASE("mbedtls CTR, input buf = output buf", "[aes]")
681 {
682 const unsigned SZ = 1000;
683 mbedtls_aes_context ctx;
684 uint8_t nonce[16];
685 uint8_t stream_block[16];
686 size_t nc_off = 0;
687
688 const uint8_t expected_cipher_end[] = {
689 0xd4, 0xdc, 0x4f, 0x8f, 0xfe, 0x86, 0xee, 0xb5,
690 0x14, 0x7f, 0xba, 0x30, 0x25, 0xa6, 0x7f, 0x6c,
691 0xb5, 0x73, 0xaf, 0x90, 0xd7, 0xff, 0x36, 0xba,
692 0x2b, 0x1d, 0xec, 0xb9, 0x38, 0xfa, 0x0d, 0xeb,
693 };
694
695 memcpy(nonce, iv, 16);
696
697 // allocate internal memory
698 uint8_t *buf = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
699
700 TEST_ASSERT_NOT_NULL(buf);
701
702 mbedtls_aes_init(&ctx);
703 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
704
705 memset(buf, 0x3A, SZ);
706
707 // Encrypt
708 mbedtls_aes_crypt_ctr(&ctx, SZ, &nc_off, nonce, stream_block, buf, buf);
709 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, buf + SZ - 32, 32);
710
711 // Decrypt
712 nc_off = 0;
713 memcpy(nonce, iv, 16);
714 mbedtls_aes_crypt_ctr(&ctx, SZ, &nc_off, nonce, stream_block, buf, buf);
715
716 for (int i = 0; i < SZ; i++) {
717 TEST_ASSERT_EQUAL_HEX8(0x3A, buf[i]);
718 }
719
720 mbedtls_aes_free(&ctx);
721 free(buf);
722 }
723
724 TEST_CASE("mbedtls OFB, chained DMA descriptors", "[aes]")
725 {
726 // Max bytes in a single DMA descriptor is 4095
727 const unsigned SZ = 6000;
728 mbedtls_aes_context ctx;
729 uint8_t nonce[16];
730 size_t nc_off = 0;
731
732 const uint8_t expected_cipher_end[] = {
733 0xfe, 0xfa, 0xc9, 0x26, 0xb5, 0xc9, 0xea, 0xb0,
734 0xdd, 0x1e, 0xe7, 0x0e, 0xfa, 0x5b, 0x4b, 0x94,
735 0xaa, 0x5f, 0x60, 0x1e, 0xb2, 0x19, 0x3c, 0x2e,
736 0xf6, 0x73, 0x56, 0x9f, 0xa7, 0xd5, 0xb7, 0x21,
737 };
738
739 memcpy(nonce, iv, 16);
740
741 // allocate internal memory
742 uint8_t *chipertext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
743 uint8_t *plaintext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
744 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
745
746 TEST_ASSERT_NOT_NULL(chipertext);
747 TEST_ASSERT_NOT_NULL(plaintext);
748 TEST_ASSERT_NOT_NULL(decryptedtext);
749
750 mbedtls_aes_init(&ctx);
751 mbedtls_aes_setkey_enc(&ctx, key_256, 256);
752
753 memset(plaintext, 0x3A, SZ);
754 memset(decryptedtext, 0x0, SZ);
755
756 // Encrypt
757 mbedtls_aes_crypt_ofb(&ctx, SZ, &nc_off, nonce, plaintext, chipertext);
758 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, chipertext + SZ - 32, 32);
759
760
761 // Decrypt
762 nc_off = 0;
763 memcpy(nonce, iv, 16);
764 mbedtls_aes_crypt_ofb(&ctx, SZ, &nc_off, nonce, chipertext, decryptedtext);
765
766 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
767
768 mbedtls_aes_free(&ctx);
769 free(plaintext);
770 free(chipertext);
771 free(decryptedtext);
772 }
773
774
775
776 #ifdef CONFIG_SPIRAM_USE_MALLOC
777
778 const uint8_t expected_cipher_psram_end[] = {
779 0x7e, 0xdf, 0x13, 0xf3, 0x56, 0xef, 0x67, 0x01,
780 0xfc, 0x08, 0x49, 0x62, 0xfa, 0xfe, 0x0c, 0x8b,
781 0x99, 0x39, 0x09, 0x51, 0x2c, 0x9a, 0xd5, 0x48,
782 0x4f, 0x76, 0xa2, 0x19, 0x2c, 0x08, 0x9d, 0x6a,
783 };
784
785
aes_psram_ctr_test(uint32_t input_buf_caps,uint32_t output_buf_caps)786 void aes_psram_ctr_test(uint32_t input_buf_caps, uint32_t output_buf_caps)
787 {
788 mbedtls_aes_context ctx;
789 uint8_t nonce[16];
790 uint8_t key[16];
791 uint8_t stream_block[16];
792 size_t SZ = 6000;
793 size_t ALIGNMENT_SIZE_BYTES = 16;
794 memset(nonce, 0x2F, 16);
795 memset(key, 0x1E, 16);
796
797 // allocate memory according the requested caps
798 uint8_t *chipertext = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, output_buf_caps);
799 uint8_t *plaintext = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, input_buf_caps);
800 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
801
802 TEST_ASSERT_NOT_NULL(chipertext);
803 TEST_ASSERT_NOT_NULL(plaintext);
804 TEST_ASSERT_NOT_NULL(decryptedtext);
805
806 mbedtls_aes_init(&ctx);
807 mbedtls_aes_setkey_enc(&ctx, key, 128);
808 memset(plaintext, 0x26, SZ + ALIGNMENT_SIZE_BYTES);
809
810 size_t offset;
811
812 /* Shift buffers and test for all different misalignments */
813 for (int i = 0; i < ALIGNMENT_SIZE_BYTES; i++ ) {
814 // Encrypt with input buffer in external ram
815 offset = 0;
816 memset(nonce, 0x2F, 16);
817 mbedtls_aes_crypt_ctr(&ctx, SZ, &offset, nonce, stream_block, plaintext + i, chipertext + i);
818 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_psram_end, chipertext + i + SZ - 32, 32);
819
820 // Decrypt
821 offset = 0;
822 memset(nonce, 0x2F, 16);
823 // Decrypt with input buffer in instruction memory, the crypto DMA can't access this
824 mbedtls_aes_crypt_ctr(&ctx, SZ, &offset, nonce, stream_block, chipertext + i, decryptedtext);
825
826 TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, SZ);
827
828 }
829
830 mbedtls_aes_free(&ctx);
831 free(plaintext);
832 free(chipertext);
833 free(decryptedtext);
834 }
835
aes_psram_one_buf_ctr_test(void)836 void aes_psram_one_buf_ctr_test(void)
837 {
838 mbedtls_aes_context ctx;
839 uint8_t nonce[16];
840 uint8_t key[16];
841 uint8_t stream_block[16];
842 size_t SZ = 6000;
843 size_t ALIGNMENT_SIZE_BYTES = 16;
844 memset(nonce, 0x2F, 16);
845 memset(key, 0x1E, 16);
846
847 // allocate external memory
848 uint8_t *buf = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
849
850 TEST_ASSERT_NOT_NULL(buf);
851
852 mbedtls_aes_init(&ctx);
853 mbedtls_aes_setkey_enc(&ctx, key, 128);
854 memset(buf, 0x26, SZ + ALIGNMENT_SIZE_BYTES);
855
856 size_t offset;
857
858 /* Shift buffers and test for all different misalignments */
859 for (int i = 0; i < ALIGNMENT_SIZE_BYTES; i++ ) {
860 // Encrypt with input buffer in external ram
861 offset = 0;
862 memset(buf, 0x26, SZ + ALIGNMENT_SIZE_BYTES);
863 memset(nonce, 0x2F, 16);
864 mbedtls_aes_crypt_ctr(&ctx, SZ, &offset, nonce, stream_block, buf + i, buf + i);
865 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_psram_end, buf + i + SZ - 32, 32);
866
867 // Decrypt
868 offset = 0;
869 memset(nonce, 0x2F, 16);
870 // Decrypt with input buffer in instruction memory, the crypto DMA can't access this
871 mbedtls_aes_crypt_ctr(&ctx, SZ, &offset, nonce, stream_block, buf + i, buf);
872
873 TEST_ASSERT_EACH_EQUAL_HEX8(0x26, buf + i, SZ - i);
874
875 }
876 mbedtls_aes_free(&ctx);
877 free(buf);
878 }
879
880
881 const uint8_t long_input[] = {
882 0xf7, 0xe6, 0x6b, 0x8d, 0x2e, 0xbf, 0x88, 0xd6,
883 0xb0, 0x77, 0xdf, 0x72, 0xbf, 0xa8, 0x0, 0x55,
884 0xd5, 0xd1, 0x49, 0xa3, 0x2c, 0xc, 0xfe, 0xdb,
885 0x17, 0x37, 0xa4, 0x1d, 0x70, 0x6b, 0x99, 0xf5,
886 0x9e, 0x6, 0xad, 0x6c, 0xe0, 0x3b, 0xfa, 0x50,
887 0x28, 0xb2, 0x62, 0xf2, 0x99, 0x3a, 0xcc, 0xe4,
888 0x86, 0x5f, 0x1, 0xf8, 0x69, 0xd7, 0xf5, 0xb2,
889 0x8a, 0x5f, 0x5c, 0x38, 0x9f, 0x8a, 0xb8, 0x8c,
890 0xea, 0x6, 0xe1, 0x68, 0xff, 0xaf, 0x5d, 0xd9,
891 0x1f, 0xa5, 0x5c, 0x8c, 0x52, 0xa1, 0x5f, 0x45,
892 0x55, 0xcb, 0x76, 0x59, 0x8f, 0xfe, 0x36, 0xd0,
893 0x85, 0x1f, 0x8, 0x90, 0x6f, 0x62, 0xb1, 0x1a,
894 0xde, 0x75, 0xab, 0x90, 0xb7, 0x75, 0xe9, 0xa0,
895 0xa9, 0xb0, 0xac, 0x61, 0x5, 0x6d, 0x9a, 0xe3,
896 0x3b, 0x43, 0x61, 0x13, 0x8c, 0x3a, 0xa0, 0xaa,
897 0x91, 0xea, 0x3e, 0xe1, 0x87, 0x35, 0xff, 0x90,
898 0xe2, 0x43, 0xa3, 0x70, 0x57, 0x65, 0x2d, 0xa2,
899 0x65, 0xe6, 0xde, 0xb0, 0x52, 0x85, 0x5b, 0xb8,
900 0x3, 0x8, 0x63, 0x8b, 0xa1, 0xc2, 0xe1, 0x35,
901 0x2e, 0xba, 0xe0, 0x84, 0x56, 0x52, 0x5f, 0x12,
902 0xd3, 0x22, 0x8d, 0xa5, 0xbb, 0xe1, 0xd3, 0xfc,
903 0x18, 0x1c, 0x90, 0x3b, 0x79, 0xe, 0xab, 0x2d,
904 0x5e, 0xb0, 0x7, 0xbb, 0x46, 0x73, 0x1d, 0x35,
905 0xd9, 0xc5, 0xa7, 0x87, 0x80, 0xf7, 0xee, 0x29,
906 0xb5, 0x17, 0xf3, 0xaf, 0x30, 0xe5, 0x19, 0x50,
907 0xf9, 0x5d, 0x2b, 0xc3, 0xc0, 0xda, 0x8f, 0xca,
908 0x3c, 0x4d, 0xd5, 0xd7, 0x6c, 0xd2, 0x36, 0xa4,
909 0x22, 0x8, 0x66, 0x48, 0x31, 0xb4, 0x3d, 0xc2,
910 0xf6, 0x6b, 0xce, 0xf0, 0x12, 0xe4, 0x38, 0x5c,
911 0xd8, 0x71, 0xea, 0x30, 0x52, 0xdf, 0x34, 0x62,
912 0xdc, 0xb4, 0x30, 0xe, 0x74, 0xc, 0x5, 0x14,
913 0xf, 0x47, 0x25, 0x5, 0x72, 0xc9, 0x14, 0x7c,
914 0x1f, 0x6e, 0xdb, 0x6f, 0x83, 0x6, 0xa0, 0xb2,
915 0x7f, 0x29, 0xe6, 0xb6, 0xe3, 0x11, 0x23, 0x4b,
916 0x68, 0x92, 0xa, 0x49, 0xb5, 0x9d, 0x5d, 0x39,
917 0x90, 0xff, 0x9, 0xa0, 0xa, 0x69, 0x6b, 0x2,
918 0x18, 0xfb, 0xca, 0x5a, 0x91, 0x1a, 0xd9, 0x19,
919 0x6b, 0xd4, 0x92, 0xd3, 0xd9, 0x7, 0xce, 0xcb,
920 0xc7, 0xf3, 0xa1, 0x33, 0xcd, 0xa9, 0xb1, 0x44,
921 0x8c, 0x93, 0xcd, 0xac, 0xc1, 0x44, 0x12, 0x48,
922 0x95, 0x3, 0xdf, 0xc, 0x2f, 0xfc, 0x34, 0x8d,
923 0x3, 0xde, 0xc1, 0xed, 0xdc, 0xf0, 0xfa, 0xa5,
924 0xb2, 0x62, 0xcd, 0xa2, 0xbf, 0xf7, 0x7e, 0x47,
925 0xb6, 0xcc, 0xe4, 0xa6, 0x4e, 0x51, 0xc6, 0x34,
926 0xee, 0x83, 0x21, 0xb7, 0xc2, 0xe3, 0x13, 0x92,
927 0xfc, 0xc9, 0x6, 0x6b, 0x91, 0x76, 0x7b, 0x2e,
928 0x1e, 0xa2, 0xe0, 0x17, 0xab, 0x10, 0xfa, 0xac,
929 0xd1, 0x2, 0x33, 0xb0, 0xd3, 0x3d, 0xb9, 0xce,
930 0xea, 0xe9, 0x93, 0x5c, 0x98, 0x14, 0x0, 0xc6,
931 0x2c, 0xa6, 0xdb, 0x1f, 0xdc, 0x76, 0xfb, 0xeb,
932 0x9d, 0x55, 0xa6, 0x5f, 0xd5, 0x8e, 0x13, 0x39,
933 0x88, 0x58, 0xff, 0xe8, 0xb4, 0x98, 0x9e, 0x4b,
934 0xe7, 0x46, 0xdc, 0x7a, 0x68, 0x5b, 0xa8, 0xc2,
935 0xe5, 0xa9, 0x50, 0xe2, 0x8, 0x31, 0x6, 0x3e,
936 0x8e, 0xaf, 0x80, 0x24, 0x4e, 0xbd, 0x73, 0x6d,
937 0xd9, 0x4b, 0xb4, 0x3e, 0x84, 0x5e, 0x31, 0x8e,
938 0xf7, 0xa8, 0x9b, 0x5e, 0x2c, 0xd5, 0xe9, 0x7c,
939 0xca, 0xca, 0xfa, 0x8e, 0x87, 0xbf, 0xf5, 0xa3,
940 0x2f, 0x73, 0x2f, 0xc0, 0x5f, 0x46, 0xf4, 0x2,
941 0xfd, 0xd1, 0x23, 0x6f, 0xc2, 0xc1, 0xc0, 0x86,
942 0x62, 0x43, 0xc3, 0x44, 0x3b, 0x2c, 0x3d, 0xc2,
943 0xd5, 0xe0, 0x2, 0xae, 0x1, 0x5a, 0x9, 0x89,
944 0x52, 0x34, 0xdf, 0xb1, 0x6c, 0x2b, 0x85, 0x77,
945 0xa5, 0x83, 0xe3, 0xa5, 0x50, 0x13, 0x2f, 0xf3,
946 0xa6, 0x83, 0x60, 0x33, 0xba, 0xd5, 0xd2, 0x96,
947 0x8a, 0xcd, 0xee, 0xfa, 0x76, 0x2a, 0x63, 0xec,
948 0x41, 0x3a, 0xf3, 0xe5, 0x9e, 0x1d, 0x5e, 0x46,
949 0x8, 0xd7, 0xe2, 0x3a, 0x25, 0x6f, 0x37, 0x7e,
950 0x0, 0x2d, 0x3d, 0x1b, 0x86, 0xf4, 0xbe, 0x0,
951 0x3c, 0xda, 0x82, 0x4a, 0xa3, 0x8, 0x2a, 0x38,
952 0x95, 0xe, 0x38, 0xf8, 0x18, 0x6c, 0x42, 0x6f,
953 0x30, 0x19, 0x8e, 0x22, 0xf6, 0xb7, 0x18, 0xb7,
954 0x93, 0xd, 0x54, 0x72, 0x4, 0x64, 0xc1, 0x19,
955 0x76, 0x6e, 0xfc, 0x9e, 0xb0, 0x7c, 0x20, 0x37,
956 0xb0, 0xcb, 0x82, 0x3a, 0x20, 0x1d, 0x12, 0x44,
957 0xbf, 0x44, 0xc4, 0x4d, 0x33, 0x7e, 0x7b, 0xeb,
958 0xd8, 0xb8, 0xa1, 0x75, 0x9e, 0x47, 0x99, 0x64,
959 0x92, 0xd3, 0x21, 0x1d, 0x72, 0x63, 0xc7, 0xb3,
960 0x3d, 0xfc, 0xb9, 0x4, 0x65, 0x18, 0x94, 0xcc,
961 0x20, 0xfe, 0x6f, 0x66, 0x36, 0xba, 0x36, 0x2a,
962 0x7, 0xf0, 0x5e, 0x8a, 0xf2, 0x7, 0x1e, 0x9e,
963 0x47, 0x2a, 0xc3, 0x7d, 0x7a, 0x20, 0x3c, 0x30,
964 0x6f, 0xbe, 0x43, 0x5e, 0x71, 0x6f, 0xd, 0xb8,
965 0x3d, 0x1d, 0x3e, 0x18, 0x65, 0x62, 0x75, 0xe8,
966 0x34, 0xfd, 0x72, 0xbb, 0xd9, 0x3f, 0xf0, 0xa2,
967 0x55, 0xee, 0x91, 0x12, 0x88, 0xda, 0x7, 0x3d,
968 0x44, 0x88, 0x70, 0x1f, 0xe0, 0xbe, 0x4b, 0x88,
969 0xa8, 0x8e, 0x28, 0x7, 0x73, 0xfd, 0x3f, 0xff,
970 0x3e, 0xb2, 0xb5, 0xdb, 0x18, 0x48, 0x9e, 0x73,
971 0x6e, 0xd7, 0x24, 0xa9, 0x25, 0xdb, 0x4, 0xe0,
972 0xe0, 0xf4, 0x45, 0xc0, 0x1b, 0x82, 0xdf, 0x4e,
973 0x48, 0x60, 0x85, 0x9c, 0xd8, 0x90, 0x32, 0xca,
974 0x4b, 0xf9, 0xb4, 0xb8, 0xe1, 0xfe, 0xd2, 0xe0,
975 0xb2, 0xd6, 0xb8, 0x19, 0x38, 0x34, 0x17, 0x8d,
976 0x5e, 0xdf, 0xf4, 0xf1, 0xac, 0x2c, 0x88, 0x7f,
977 0x54, 0xbc, 0xf1, 0x39, 0xf2, 0xaf, 0x5a, 0xff,
978 0xa7, 0x96, 0x0, 0xf0, 0x27, 0x79, 0x27, 0x2e,
979 0x9c, 0xf1, 0x4b, 0xa3, 0xad, 0xdc, 0x8a, 0x2c,
980 0x9, 0x4c, 0xd3, 0xcd, 0xd0, 0x2d, 0xb1, 0xec,
981 0x4d, 0x68, 0x40, 0xb8, 0xc5, 0x5, 0xfa, 0xb2,
982 0x61, 0xb8, 0x31, 0x5, 0xea, 0xb8, 0xa3, 0x34,
983 0xa8, 0x8b, 0x3, 0x5b, 0x22, 0x93, 0xba, 0x91,
984 0x33, 0x3f, 0x8b, 0x5e, 0xed, 0x86, 0x23, 0x95,
985 0xbc, 0x9e, 0xdf, 0xa9, 0x8c, 0xca, 0xb9, 0x97,
986 0x9b, 0xc5, 0xca, 0xf4, 0xff, 0x4d, 0x62, 0x52,
987 0x1c, 0xd3, 0x4c, 0x42, 0xbf, 0x8a, 0x25, 0x47,
988 0xc7, 0x9, 0x4e, 0xe0, 0xb1, 0x72, 0x7d, 0x2,
989 0x8f, 0xca, 0x4f, 0x4, 0xc8, 0x74, 0x82, 0x8e,
990 0x53, 0xfd, 0xa1, 0x37, 0xda, 0x29, 0x5c, 0xa3,
991 0x83, 0xe9, 0xa8, 0xd8, 0x25, 0x27, 0xfe, 0xf7,
992 0x41, 0xc4, 0xb0, 0xee, 0x1d, 0x89, 0x1c, 0xe7,
993 0xef, 0x86, 0x68, 0xd8, 0x87, 0x4c, 0x4f, 0x49,
994 0xeb, 0xbc, 0xb3, 0x81, 0xa7, 0xf4, 0xb4, 0x9b,
995 0xc1, 0x52, 0x93, 0x7e, 0xdf, 0x75, 0x75, 0xfc,
996 0x45, 0xb2, 0x86, 0xa9, 0x50, 0xb5, 0xa3, 0xf7,
997 0x61, 0x60, 0xe4, 0x13, 0x99, 0xc0, 0xf8, 0x49,
998 0x7b, 0x61, 0x8b, 0xa8, 0xfa, 0x77, 0x0, 0xe4,
999 0x6, 0x9a, 0xc5, 0x51, 0xe4, 0xeb, 0xaf, 0x5f,
1000 0xb9, 0x5c, 0x74, 0xc8, 0xf8, 0x3e, 0x62, 0x26,
1001 0xe, 0xe5, 0x85, 0xca, 0x49, 0xa0, 0x2f, 0xf7,
1002 0x7, 0x99, 0x3e, 0x5c, 0xe0, 0x72, 0xfa, 0xd4,
1003 0x80, 0x2e, 0xd6, 0x40, 0x6, 0xde, 0x5f, 0xc5,
1004 0xc5, 0x1, 0xd, 0xbf, 0xdb, 0xb6, 0xb3, 0x92,
1005 0x76, 0xb3, 0x3f, 0x3d, 0x5d, 0x1, 0x23, 0xb8,
1006 0xa, 0xcb, 0x80, 0x17, 0x31, 0x19, 0xc7, 0x64,
1007 0x69, 0xf1, 0x99, 0x53, 0xe5, 0xf2, 0x9f, 0x9d,
1008 0x3c, 0xda, 0xcb, 0xa6, 0x94, 0x94, 0x44, 0xd3,
1009 0xc6, 0x8b, 0xb5, 0xae, 0x45, 0x25, 0xef, 0x2a,
1010 0x24, 0x1, 0x3a, 0xf6, 0xf, 0xe, 0xcb, 0x10,
1011 0xc4, 0xe0, 0xf4, 0x3d, 0xf4, 0xf5, 0xea, 0x9b,
1012 0xd1, 0x16, 0x1b, 0x62, 0x11, 0x3e, 0x20, 0x3a,
1013 0x68, 0xc8, 0xf0, 0xe, 0x55, 0xbe, 0x51, 0x4d,
1014 0xbe, 0x1f, 0x4f, 0xda, 0x84, 0xda, 0xc4, 0x9e,
1015 0x24, 0xd7, 0x46, 0x82, 0x56, 0x4e, 0x61, 0x63,
1016 0xda, 0x18, 0xea, 0xc6, 0xc3, 0x21, 0x89, 0x18,
1017 0xe, 0x87, 0xb7, 0x91, 0xfe, 0x8d, 0xe, 0xac,
1018 0x75, 0x58, 0xe5, 0x9f, 0x1f, 0x93, 0xa6, 0x49,
1019 0x24, 0xa2, 0xc6, 0xe8, 0x9d, 0x9c, 0x6d, 0xc1,
1020 0xf, 0xfc, 0xe3, 0x57, 0xd3, 0xc2, 0x10, 0x91,
1021 0x9a, 0xa8, 0xaa, 0xd7, 0xf, 0xaa, 0x75, 0x90,
1022 0x4a, 0x10, 0xef, 0xb6, 0xdd, 0x6c, 0xd5, 0x1a,
1023 0xe3, 0xbb, 0xe0, 0x64, 0x44, 0xc, 0x59, 0xa1,
1024 0xef, 0x3, 0x52, 0xac, 0xa4, 0x85, 0x3e, 0x40,
1025 0xee, 0x5c, 0xef, 0xcf, 0xb1, 0xaa, 0x88, 0xe5,
1026 0x56, 0xb8, 0xcd, 0x87, 0xc7, 0xc6, 0xd3, 0xb4,
1027 0x85, 0x8f, 0x2a, 0xc9, 0xcd, 0x8a, 0x8b, 0x25,
1028 0x12, 0x71, 0x76, 0xc9, 0xaa, 0x62, 0x75, 0x80,
1029 0x6e, 0xa3, 0xf9, 0xa5, 0xfc, 0x90, 0xac, 0x28,
1030 0x13, 0x82, 0xbb, 0x5d, 0xa6, 0x93, 0x47, 0xd4,
1031 0xf, 0x3b, 0x19, 0xf6, 0x81, 0xdb, 0x55, 0xb0,
1032 0x47, 0x75, 0x63, 0x93, 0xb4, 0xdd, 0xf0, 0xaf,
1033 0xb7, 0x44, 0xcb, 0x7, 0x7b, 0x35, 0xc5, 0xe4,
1034 0x45, 0xfe, 0xbb, 0x11, 0x1a, 0x90, 0x96, 0x3a,
1035 0x7, 0x2a, 0xef, 0x9c, 0xc, 0xae, 0x38, 0x26,
1036 0xef, 0xc2, 0xc3, 0x53, 0xfa, 0x54, 0xcf, 0x6f,
1037 0xf7, 0xa, 0xea, 0x19, 0xa8, 0xf, 0xbd, 0xa7,
1038 0x3f, 0xcd, 0x38, 0x2c, 0xf3, 0x97, 0xfb, 0xdb,
1039 0xcb, 0xc5, 0x83, 0x80, 0x91, 0x3d, 0xc7, 0x29,
1040 0x67, 0x16, 0xa5, 0xd1, 0x41, 0xd0, 0xa1, 0x9b,
1041 0xde, 0x13, 0x83, 0x12, 0x36, 0x75, 0x81, 0x71,
1042 0x6b, 0xbc, 0x72, 0xcb, 0x37, 0x4, 0x6, 0x7c,
1043 0x3a, 0x22, 0x2b, 0xa, 0x11, 0xd3, 0x33, 0x8f,
1044 0x3, 0x54, 0x8e, 0x79, 0xb6, 0x36, 0x93, 0x92,
1045 0xb8, 0xf, 0x24, 0x4a, 0xd3, 0xd5, 0x27, 0x66,
1046 0xd1, 0xde, 0xe3, 0xaa, 0x4b, 0x2a, 0xe9, 0x22,
1047 0x9b, 0xbf, 0x6e, 0x9a, 0xf7, 0xa, 0x2f, 0x24,
1048 0x13, 0xd5, 0xd5, 0xbb, 0xa3, 0xba, 0x8f, 0xfc,
1049 0x28, 0xa8, 0xbe, 0xe6, 0x9f, 0xea, 0xed, 0xb1,
1050 0xba, 0xaf, 0xf, 0x1c, 0x1e, 0x51, 0xf8, 0xd7,
1051 0x1b, 0xa5, 0xa6, 0x63, 0x40, 0x6e, 0x3f, 0xa2,
1052 0x57, 0x6f, 0x57, 0xe4, 0x27, 0xc2, 0x3c, 0x33,
1053 0xc6, 0x9c, 0x24, 0xd0, 0x53, 0xc4, 0xfc, 0xed,
1054 0x8e, 0x1d, 0xf, 0xc3, 0x86, 0x9, 0x3d, 0x1d,
1055 0xc2, 0xdb, 0x24, 0x1a, 0x65, 0xf4, 0x30, 0xa5,
1056 0xc, 0x48, 0x37, 0xc5, 0x53, 0x35, 0x3b, 0xab,
1057 0xd, 0x96, 0x30, 0xd7, 0x1d, 0x66, 0x18, 0xc2,
1058 0x47, 0x3a, 0xef, 0xbe, 0x2e, 0xe4, 0x54, 0x9d,
1059 0xc4, 0xa5, 0xb9, 0xb3, 0x4c, 0x12, 0x73, 0x35,
1060 0xf0, 0x7, 0xe, 0x36, 0x88, 0xb2, 0x4b, 0x29,
1061 0xb, 0x4e, 0x84, 0x11, 0xaa, 0x9a, 0x3e, 0xb1,
1062 0xd7, 0xec, 0xfb, 0x7f, 0x10, 0x70, 0x1f, 0x26,
1063 0xf0, 0x27, 0x46, 0x5d, 0x4, 0x51, 0x97, 0x29,
1064 0xb4, 0x66, 0x39, 0x1, 0x82, 0x47, 0xd8, 0x5f,
1065 0xa9, 0xb3, 0xa1, 0xb8, 0xde, 0x1, 0xe1, 0xc4,
1066 0x47, 0xc5, 0xe8, 0xe6, 0xbb, 0xc0, 0xb6, 0x41,
1067 0x55, 0x10, 0x79, 0xa8, 0xd0, 0xd, 0x1, 0x56,
1068 0x29, 0x6c, 0xa5, 0x96, 0x87, 0x59, 0x4b, 0xd,
1069 0xc8, 0x3, 0x5, 0xaa, 0xa9, 0x6a, 0xb1, 0x10,
1070 0xbc, 0x1, 0x68, 0xd3, 0xa5, 0x52, 0x41, 0xe1,
1071 0x1f, 0x53, 0x7, 0xc6, 0xad, 0xb8, 0xc4, 0xf0,
1072 0x28, 0xe9, 0x3, 0x3a, 0xee, 0xce, 0x2c, 0xe2,
1073 0xb0, 0xda, 0x78, 0x3d, 0x37, 0x7, 0x2d, 0x1f,
1074 0xf1, 0x47, 0x81, 0x4, 0x67, 0x6e, 0xd, 0xa1,
1075 0x2b, 0x4, 0xe8, 0xd9, 0xf4, 0xaf, 0x35, 0xca,
1076 0xa5, 0xd1, 0xe3, 0xec, 0xc5, 0x82, 0x50, 0x99,
1077 0x9a, 0xee, 0xea, 0x53, 0x41, 0x86, 0x97, 0x44,
1078 0xeb, 0x58, 0x43, 0x47, 0xe7, 0xa0, 0xd3, 0x28,
1079 0xfc, 0xe7, 0x13, 0x8b, 0x56, 0xe3, 0xdb, 0xa9,
1080 0xcd, 0x9, 0xc8, 0x7, 0x11, 0xeb, 0xbf, 0xac,
1081 0x76, 0x72, 0x60, 0xaf, 0x9c, 0xba, 0x8a, 0x64,
1082 0xfb, 0xf4, 0xab, 0x27, 0x29, 0xe7, 0xec, 0x69,
1083 0x21, 0xcb, 0x5b, 0x79, 0x56, 0x10, 0xc1, 0x8,
1084 0xd5, 0x5d, 0x93, 0xb1, 0x70, 0x88, 0xf2, 0x19,
1085 0x41, 0xc6, 0xc2, 0x84, 0xdd, 0xf0, 0xb3, 0x40,
1086 0x12, 0x71, 0x24, 0x54, 0xc4, 0x5e, 0xfb, 0x5f,
1087 0x47, 0x8c, 0xa9, 0x4, 0x5a, 0xd5, 0x61, 0x19,
1088 0xb5, 0x7f, 0xc9, 0xbd, 0x87, 0xb2, 0xcd, 0x57,
1089 0x99, 0x50, 0x67, 0x1d, 0xb0, 0x1d, 0x82, 0xdd,
1090 0xef, 0x32, 0x38, 0xb9, 0xc7, 0x86, 0xb4, 0xd2,
1091 0xd6, 0xe1, 0x33, 0xb2, 0xdb, 0x5e, 0xc2, 0xa3,
1092 0x49, 0xa6, 0x5f, 0x79, 0x32, 0x50, 0x41, 0x5b,
1093 0xd7, 0x87, 0x74, 0xf5, 0xc9, 0x9c, 0x78, 0xb7,
1094 0xb, 0x1f, 0x72, 0xba, 0xd9, 0x3a, 0x4d, 0x18,
1095 0x45, 0x1d, 0xad, 0xef, 0xc4, 0xdc, 0x30, 0xe8,
1096 0x2, 0xb1, 0x7f, 0x6c, 0x8f, 0xaa, 0xd0, 0x40,
1097 0x17, 0xe, 0x58, 0x93, 0x42, 0x49, 0x63, 0x77,
1098 0x48, 0x55, 0x90, 0x2f, 0x7c, 0x3b, 0xee, 0x3c,
1099 0xac, 0xd, 0xd8, 0x72, 0x23, 0xd7, 0xa5, 0x6e,
1100 0xb0, 0xd2, 0x91, 0x25, 0x60, 0x9a, 0x52, 0xab,
1101 0xbd, 0x63, 0xce, 0xba, 0xda, 0xb1, 0xd7, 0xc7,
1102 0x3d, 0x21, 0x4e, 0x9c, 0x5a, 0x1e, 0x8d, 0xf4,
1103 0xa, 0xdb, 0xd9, 0xf, 0x20, 0x7e, 0xfb, 0xbf,
1104 0x36, 0x9c, 0x4f, 0xbd, 0xf7, 0xdb, 0x5b, 0xa2,
1105 0x6, 0xb2, 0x0, 0xe2, 0xa2, 0x9e, 0x4e, 0x19,
1106 0xd4, 0x69, 0xa9, 0x51, 0x69, 0x8b, 0xf5, 0xe1,
1107 0xad, 0x89, 0x8, 0xc5, 0x4f, 0xac, 0x1b, 0x7d,
1108 0xe7, 0xa, 0x9, 0x7d, 0x34, 0xf5, 0x3f, 0x46,
1109 0x80, 0xb9, 0xb9, 0x45, 0x58, 0xcd, 0x6c, 0xb5,
1110 0x5f, 0x60, 0xeb, 0x5a, 0xe3, 0xa3, 0x8, 0x5e,
1111 0xb1, 0xc4, 0x73, 0xc5, 0xa5, 0x67, 0x56, 0xd3,
1112 0xc6, 0x8a, 0x55, 0x6b, 0xd7, 0xd7, 0xc, 0x20,
1113 0xe6, 0xc, 0x73, 0x8, 0x2, 0x4b, 0xfb, 0xdd,
1114 0x4d, 0x4e, 0xa8, 0xb8, 0xd8, 0x4b, 0x53, 0x2f,
1115 0xc2, 0xfb, 0x5d, 0xa1, 0x6a, 0x16, 0x6b, 0xe,
1116 0xf1, 0xa1, 0xa5, 0x5b, 0xdf, 0x9c, 0x23, 0xb5,
1117 0x94, 0x9c, 0xae, 0x7b, 0xbe, 0x42, 0xb5, 0x79,
1118 0x80, 0xc3, 0x43, 0x41, 0xa4, 0x1b, 0x18, 0xfc,
1119 0x52, 0xcf, 0x43, 0xc5, 0x80, 0x7b, 0xbd, 0xc1,
1120 0x20, 0x5e, 0x65, 0xec, 0xc5, 0xfc, 0x3, 0xec,
1121 0x8f, 0x61, 0x66, 0xf5, 0x15, 0x67, 0xc8, 0xb6,
1122 0xef, 0x9a, 0xba, 0xb7, 0xcb, 0x2c, 0xac, 0x1b,
1123 0x50, 0xda, 0xb6, 0x29, 0xa4, 0x37, 0xe9, 0x96,
1124 0xa0, 0x7, 0x7d, 0x49, 0xa6, 0xce, 0xf3, 0xf0,
1125 0x19, 0xdf, 0x61, 0xc7, 0xa4, 0x7b, 0x5a, 0xd4,
1126 0x99, 0xb2, 0x64, 0xe7, 0xd1, 0x6b, 0x7f, 0xe8,
1127 0xb8, 0xd3, 0x89, 0xee, 0x96, 0xc0, 0xed, 0x5d,
1128 0x7e, 0x48, 0x2, 0xd2, 0x25, 0xd0, 0x5, 0xef,
1129 0x93, 0x72, 0x7c, 0x8c, 0xbd, 0x6e, 0x49, 0xd3,
1130 0x38, 0x46, 0x1c, 0xff, 0x28, 0x4e, 0x1b, 0xad,
1131 0x39, 0x2f, 0x65, 0x26, 0xe2, 0x70, 0x3d, 0xb8,
1132 0x7a, 0xd3, 0x38, 0x38, 0xfc, 0x3a, 0x67, 0x78,
1133 0xdb, 0x9, 0xcb, 0xbf, 0xc9, 0xe1, 0xee, 0x69,
1134 0x2b, 0xd, 0xb1, 0x79, 0x13, 0xd0, 0xa5, 0x75,
1135 0x6, 0x8, 0x79, 0xa7, 0x7c, 0xc, 0xe7, 0x1b,
1136 0x9c, 0x36, 0x64, 0xbe, 0x20, 0x65, 0xa2, 0xd4,
1137 0xd9, 0xc, 0x68, 0xe, 0x88, 0x2b, 0x93, 0x60,
1138 0xf1, 0xa5, 0x82, 0xc5, 0x4d, 0x2b, 0x7d, 0x73,
1139 0xe9, 0x13, 0x8c, 0xc1, 0x8, 0xbd, 0x21, 0x65,
1140 0x77, 0x2f, 0x34, 0xb1, 0x97, 0x9f, 0xd8, 0x55,
1141 0xcf, 0x75, 0xc2, 0xf2, 0x41, 0x68, 0xc1, 0x9c,
1142 0x1c, 0xd7, 0x23, 0xbf, 0x83, 0x2a, 0x9, 0x66,
1143 0xce, 0x8f, 0xd2, 0x12, 0x79, 0x93, 0xef, 0x8,
1144 0x9b, 0xeb, 0x2f, 0xc, 0xe4, 0x5b, 0x71, 0x1a,
1145 0xef, 0x11, 0x65, 0xd8, 0x6d, 0x8c, 0x59, 0x53,
1146 0x70, 0x1d, 0xb5, 0x81, 0xff, 0xc0, 0x7d, 0x87,
1147 0xa5, 0x21, 0x5d, 0x9f, 0x63, 0xb2, 0xe7, 0xe9,
1148 0xd0, 0x49, 0x41, 0xc7, 0x3c, 0xe1, 0x2b, 0xb1,
1149 0xac, 0x15, 0xcd, 0xb0, 0xa8, 0xdc, 0xae, 0x3b,
1150 0xef, 0x32, 0x98, 0x8c, 0xc7, 0x40, 0xa6, 0x81,
1151 0x1, 0xa1, 0x7d, 0x89, 0x46, 0x99, 0x91, 0x24,
1152 0xce, 0xb2, 0x70, 0x82, 0x92, 0xf3, 0x60, 0x66,
1153 0x34, 0x6, 0x37, 0xad, 0x5c, 0xed, 0xc3, 0x27,
1154 0x68, 0x8c, 0x56, 0xe7, 0xf, 0x73, 0x5c, 0x7e,
1155 0x9e, 0xd0, 0x8c, 0x99, 0x5a, 0xb1, 0x15, 0x98,
1156 0xbb, 0x79, 0x9f, 0xd1, 0x69, 0xce, 0x76, 0x5,
1157 0xcb, 0x8e, 0x18, 0xb3, 0x84, 0x65, 0xa9, 0x2,
1158 0xbc, 0x43, 0x8b, 0x7e, 0xe9, 0xe2, 0xe6, 0x74,
1159 0x31, 0x8d, 0xe7, 0xa2, 0x42, 0x8f, 0xca, 0x38,
1160 0x59, 0x85, 0x25, 0x47, 0xd2, 0x86, 0x47, 0x9,
1161 0xc2, 0x11, 0x2, 0x91, 0xe6, 0xf3, 0x47, 0xc2,
1162 0x9c, 0x28, 0x2f, 0xbb, 0xac, 0xde, 0x9f, 0xd,
1163 0xc2, 0x96, 0x4f, 0x43, 0xca, 0x32, 0xed, 0x34,
1164 0xba, 0xad, 0xef, 0xbe, 0x68, 0xc7, 0xa2, 0x83,
1165 0xaf, 0xe, 0xd3, 0x72, 0x52, 0xd1, 0x76, 0x3d,
1166 0x9a, 0x98, 0x39, 0xf4, 0x3e, 0x14, 0x27, 0xff,
1167 0xb2, 0x37, 0x23, 0xc5, 0x6d, 0x66, 0xef, 0xaa,
1168 0xfe, 0xe7, 0xe4, 0x86, 0xa1, 0xe, 0x4e, 0x36,
1169 0x64, 0xb1, 0x67, 0xf, 0x94, 0x6f, 0x77, 0xd5,
1170 0xec, 0xe2, 0x5e, 0xc8, 0xe3, 0x64, 0x29, 0x92,
1171 0xd, 0x20, 0x34, 0x9f, 0x19, 0x6e, 0x85, 0xf8,
1172 0x48, 0x78, 0xb0, 0xf, 0x42, 0xb2, 0x8c, 0xea,
1173 0xc2, 0x4d, 0xd3, 0x23, 0xb, 0x4d, 0x20, 0x33,
1174 0xc7, 0x46, 0x0, 0x45, 0x37, 0xc6, 0xcb, 0xd0,
1175 0xec, 0x11, 0xc6, 0x74, 0x91, 0x7d, 0x6b, 0x54,
1176 0x56, 0x10, 0x8d, 0xd0, 0xce, 0xe8, 0x57, 0x3b,
1177 0x83, 0xd8, 0x25, 0x51, 0x79, 0x48, 0xa, 0xa5,
1178 0xc3, 0xe4, 0x65, 0x33, 0xb2, 0x89, 0xa6, 0x4c,
1179 0xe8, 0xc8, 0x9e, 0xce, 0xea, 0x2a, 0x55, 0x40,
1180 0xfc, 0x26, 0x29, 0xd4, 0x2d, 0x7e, 0xe1, 0xb1,
1181 0x4d, 0x65, 0x1, 0xe9, 0x98, 0xc9, 0xf4, 0x69,
1182 0x10, 0xd9, 0xa3, 0xf9, 0x34, 0xaf, 0x3c, 0x34,
1183 0x64, 0x23, 0xde, 0xb8, 0x1c, 0x33, 0x18, 0x74,
1184 0x67, 0xb4, 0x4a, 0x71, 0xa6, 0x89, 0x2, 0xfe,
1185 0xf7, 0xf1, 0x32, 0xc7, 0x98, 0xad, 0xe5, 0x10,
1186 0x98, 0x3c, 0x6c, 0xaf, 0x1f, 0x13, 0x3d, 0xcc,
1187 0xfc, 0x3b, 0x67, 0x33, 0x34, 0xc9, 0x31, 0xcd,
1188 0x3f, 0xd, 0x3c, 0x5a, 0xb6, 0xc2, 0x8, 0xea,
1189 0xe2, 0xae, 0xdd, 0xfc, 0x6f, 0xca, 0xb5, 0x67,
1190 0x11, 0xce, 0xd5, 0xda, 0x3a, 0x8b, 0x7, 0xf2,
1191 0xc0, 0x9e, 0x78, 0x18, 0x92, 0x9f, 0x64, 0x26,
1192 0x9f, 0x66, 0x62, 0x66, 0xa1, 0x7e, 0x3, 0xf5,
1193 0xb9, 0xe6, 0x74, 0x20, 0x88, 0xb7, 0x7e, 0x62,
1194 0x7a, 0x33, 0x21, 0x9, 0x9c, 0x91, 0x3b, 0x62,
1195 0x9, 0x46, 0xd3, 0xd1, 0x1f, 0xc5, 0x3a, 0x8f,
1196 0x69, 0x27, 0x2c, 0x7b, 0xec, 0xda, 0x79, 0xf1,
1197 0xc9, 0xe9, 0x98, 0xd0, 0xa, 0xc9, 0xf6, 0x37,
1198 0x28, 0xf8, 0xfc, 0xe, 0xdc, 0xf, 0xe9, 0x23,
1199 0xf6, 0x84, 0x25, 0x96, 0x2c, 0x24, 0x14, 0xd7,
1200 0xe2, 0x5e, 0x1c, 0x56, 0x7f, 0x99, 0x98, 0x62,
1201 0x76, 0xcc, 0x84, 0x44, 0xd6, 0xb9, 0x47, 0x2b,
1202 0x52, 0xfb, 0x42, 0x40, 0xf3, 0x63, 0xaf, 0xd4,
1203 0x10, 0x5, 0xf9, 0x3b, 0xc8, 0x53, 0xa9, 0x45,
1204 0xa4, 0x50, 0x41, 0x83, 0xe8, 0x4a, 0x9, 0xb6,
1205 0xf1, 0x77, 0x70, 0xe3, 0x61, 0x30, 0xd8, 0x90,
1206 0x49, 0x52, 0x4b, 0x4a, 0xf2, 0x66, 0x84, 0xaf,
1207 0x71, 0x1, 0x40, 0x66, 0xf6, 0x3, 0xc9, 0x23,
1208 0xb1, 0x1a, 0xc1, 0xb2, 0xf7, 0x35, 0x1a, 0xc9,
1209 0x3a, 0x75, 0xb1, 0xa7, 0x4, 0xff, 0x69, 0xa,
1210 0x90, 0x58, 0xd4, 0xf4, 0x16, 0x79, 0xe1, 0xae,
1211 0x39, 0x9d, 0xbb, 0x32, 0x6b, 0x3, 0xe2, 0xf5,
1212 0x73, 0x83, 0x7e, 0x3c, 0xf8, 0x29, 0xab, 0xcc,
1213 0xdc, 0xf0, 0x13, 0xdb, 0x86, 0x28, 0x88, 0x8e,
1214 0xde, 0x6a, 0x29, 0xf1, 0xea, 0x0, 0x83, 0x97,
1215 0x1, 0x32, 0x5f, 0xaa, 0x5b, 0x1b, 0xe4, 0x87,
1216 0xec, 0x90, 0x45, 0xc7, 0xc5, 0x6c, 0x11, 0x83,
1217 0x95, 0xab, 0xdd, 0x71, 0x69, 0x24, 0xc, 0x5c,
1218 0xc0, 0xf3, 0xc1, 0xb0, 0x5e, 0x1, 0x5e, 0x4,
1219 0xa1, 0x6e, 0x6e, 0x7d, 0x3f, 0x6f, 0xbd, 0x5d,
1220 0x9, 0x8f, 0x23, 0x53, 0x74, 0x4b, 0xa9, 0x53,
1221 0xd2, 0x10, 0xa1, 0xc0, 0x8e, 0x18, 0xa, 0x2f,
1222 0x88, 0x8d, 0x4b, 0xf8, 0xc2, 0x3d, 0xeb, 0x34,
1223 0x23, 0xa, 0x80, 0xc, 0x69, 0x21, 0x3, 0xc1,
1224 0x6f, 0xbe, 0xdf, 0xf6, 0x2c, 0x27, 0x77, 0xa2,
1225 0xc5, 0x5c, 0x9, 0x54, 0x5d, 0x4a, 0x4c, 0xb,
1226 0x6b, 0xb5, 0x88, 0x11, 0x42, 0x62, 0x39, 0x89,
1227 0x9e, 0x36, 0xd3, 0x91, 0xf6, 0x70, 0x18, 0x35,
1228 0x79, 0xaf, 0x73, 0xf3, 0x0, 0x75, 0x5a, 0xa3,
1229 0xce, 0xf1, 0x42, 0x80, 0x19, 0x5e, 0x42, 0x56,
1230 0x53, 0x85, 0xbb, 0xf4, 0x29, 0xac, 0x84, 0x1d,
1231 0x97, 0x1, 0x1c, 0xc4, 0x58, 0xcb, 0x33, 0xc4,
1232 0xdc, 0x1e, 0x59, 0x8f, 0x48, 0xa9, 0x59, 0xfd,
1233 0xaf, 0xa3, 0x5c, 0x19, 0x17, 0x6b, 0x46, 0x2d,
1234 0xab, 0x44, 0xa3, 0xcc, 0x1a, 0xaa, 0x23, 0x4e,
1235 0x58, 0x37, 0x7b, 0x11, 0x14, 0xc2, 0xf1, 0xc9,
1236 0x58, 0x99, 0xd3, 0x3c, 0xec, 0xb9, 0xbe, 0x17,
1237 0x3c, 0x8d, 0x1c, 0x87, 0x9d, 0xe1, 0xb9, 0xad,
1238 0x68, 0x36, 0xd5, 0xfc, 0x24, 0x9b, 0x34, 0x5,
1239 0x26, 0xac, 0x15, 0x9f, 0xd6, 0x70, 0x74, 0x6c,
1240 0x72, 0xf, 0x6, 0x6, 0x5a, 0xc, 0xc0, 0x78,
1241 0x47, 0x8e, 0xcf, 0xf2, 0xce, 0x8, 0xe2, 0xa4,
1242 0xc6, 0x7d, 0x2d, 0x70, 0x14, 0xe2, 0xc6, 0xfc,
1243 0x63, 0x7a, 0x42, 0x8c, 0x45, 0xae, 0xe8, 0x3b,
1244 0x30, 0x48, 0xda, 0x3e, 0x14, 0xb5, 0x8b, 0x10,
1245 0xae, 0x56, 0xbd, 0x17, 0xdf, 0xcb, 0x63, 0xf5,
1246 0xb, 0x2b, 0xd7, 0x34, 0x7c, 0x96, 0x43, 0xe9,
1247 0x17, 0xd4, 0x53, 0x2b, 0x4e, 0xba, 0x61, 0x57,
1248 0x92, 0xdb, 0xe8, 0x37, 0xf4, 0xa3, 0x59, 0x88,
1249 0x74, 0xc2, 0x3c, 0x5d, 0x54, 0x30, 0xb9, 0x6,
1250 0xbe, 0x75, 0x13, 0xe8, 0xf2, 0xe8, 0xcb, 0x45,
1251 0x73, 0x70, 0xaf, 0x94, 0xe6, 0xc5, 0xb0, 0xdf,
1252 0xd2, 0xd5, 0x57, 0x97, 0x7c, 0x97, 0xde, 0x55,
1253 0xaf, 0xbb, 0xed, 0x19, 0x35, 0x17, 0xf4, 0x23,
1254 0x38, 0x9c, 0xce, 0x37, 0xfe, 0xd8, 0x4e, 0xd8,
1255 0x99, 0xba, 0x33, 0x22, 0xf2, 0xeb, 0xab, 0x97,
1256 0xee, 0x9d, 0xab, 0x67, 0x95, 0x35, 0xdf, 0xc8,
1257 0xb6, 0xa0, 0xf, 0x15, 0x51, 0xa9, 0x76, 0x15,
1258 0xdd, 0xbd, 0xac, 0x12, 0xce, 0x51, 0xde, 0x68,
1259 0x15, 0xaf, 0x27, 0xcf, 0xd1, 0xba, 0x7c, 0x17,
1260 0xef, 0xbf, 0xbb, 0xc0, 0x6e, 0x58, 0x73, 0xf6,
1261 0x57, 0xe1, 0x8d, 0xb0, 0x9a, 0x5a, 0x9, 0x19,
1262 0xef, 0xdd, 0x4, 0xe1, 0x76, 0x94, 0x31, 0xd7,
1263 0x26, 0x9f, 0x9c, 0x27, 0xc4, 0x2b, 0x4b, 0xf6,
1264 0x3b, 0xa1, 0x8c, 0xf4, 0x21, 0xde, 0x39, 0x14,
1265 0x5a, 0x54, 0xac, 0x95, 0x2f, 0xa0, 0x60, 0x53,
1266 0x87, 0x5b, 0x71, 0x92, 0xae, 0xf9, 0x6c, 0x62,
1267 0x76, 0x7e, 0x91, 0x11, 0xa6, 0xf4, 0xf2, 0xa8,
1268 0xdf, 0xc1, 0xf6, 0x3a, 0xdb, 0x34, 0x96, 0x9,
1269 0x71, 0xb4, 0x4, 0xfa, 0xd4, 0x3, 0x46, 0x16,
1270 0x78, 0x41, 0x42, 0x7d, 0x15, 0x68, 0x63, 0x55,
1271 0x23, 0x4, 0x46, 0x5d, 0xe1, 0xd8, 0xe7, 0x5f,
1272 0x55, 0x39, 0xd2, 0x45, 0xb2, 0x0, 0x35, 0xde,
1273 0xd8, 0x9d, 0xc7, 0x3a, 0x8f, 0x37, 0x7e, 0xe5,
1274 0x9e, 0xcf, 0xd1, 0x6a, 0x22, 0xe1, 0x51, 0xb2,
1275 0xe6, 0x99, 0x3e, 0x83, 0xeb, 0x34, 0x9d, 0x34,
1276 0x7, 0x1c, 0xbe, 0x91, 0x69, 0x9e, 0xaa, 0xcb,
1277 0x86, 0xd2, 0xb6, 0xed, 0xa5, 0x4, 0xf9, 0x7d,
1278 0xf8, 0xba, 0x2a, 0x27, 0x38, 0xe1, 0xaa, 0x22,
1279 0x94, 0x46, 0x1f, 0x1b, 0xcf, 0xc4, 0x78, 0x88,
1280 0x3d, 0x50, 0x83, 0x30, 0x61, 0x87, 0xb6, 0x38,
1281 0x5b, 0x4f, 0x5a, 0x3, 0x2d, 0x5d, 0xa6, 0x33,
1282 0x38, 0xe7, 0x8b, 0x60, 0x1, 0x8e, 0xde, 0x69,
1283 0x8e, 0x4d, 0x60, 0x24, 0x3b, 0x47, 0x4b, 0x56,
1284 0xea, 0xf9, 0xc8, 0xfa, 0x2d, 0x65, 0x7b, 0xad,
1285 0xee, 0xe4, 0x91, 0x20, 0x6f, 0x64, 0x6e, 0x81,
1286 0x69, 0xda, 0xf5, 0x3c, 0x3d, 0xff, 0x4c, 0xe9,
1287 0x9b, 0x4d, 0xa8, 0x67, 0x9e, 0x67, 0x7f, 0x84,
1288 0xdb, 0x7a, 0xb7, 0x24, 0x32, 0xa0, 0x80, 0x16,
1289 0x55, 0x2d, 0x1d, 0xc1, 0x3a, 0x19, 0xd3, 0x17,
1290 0x74, 0x8e, 0x2a, 0x5c, 0xf6, 0x71, 0xf7, 0x25,
1291 0x3a, 0x54, 0x28, 0xef, 0x50, 0x78, 0x14, 0x5,
1292 0x49, 0x8a, 0xbb, 0x71, 0xb2, 0xed, 0xa2, 0x5b,
1293 0xff, 0x2, 0xe, 0xd8, 0x1a, 0x8b, 0x3c, 0xcc,
1294 0x58, 0x27, 0x71, 0x2d, 0xb, 0x11, 0x9f, 0x6,
1295 0xc3, 0xfd, 0x37, 0x19, 0xdb, 0xec, 0xa5, 0x4b,
1296 0x93, 0x81, 0xb6, 0xff, 0xd4, 0xf5, 0x7b, 0xf5,
1297 0x49, 0x5b, 0x95, 0x9, 0xa4, 0xca, 0xa5, 0x33,
1298 0x9a, 0xfc, 0x97, 0xec, 0x7b, 0xb, 0xb9, 0x2e,
1299 0x3b, 0x9d, 0x52, 0xc2, 0xa2, 0x9, 0xc8, 0xbf,
1300 0x39, 0x16, 0xce, 0x42, 0x3, 0x4b, 0xe3, 0xfc,
1301 0xfd, 0xc, 0x37, 0x96, 0x10, 0x36, 0xad, 0x44,
1302 0xda, 0xc5, 0x58, 0x3e, 0x78, 0x52, 0xa1, 0x65,
1303 0xed, 0x89, 0xe7, 0xea, 0xbf, 0xa8, 0x6a, 0xf2,
1304 0xa7, 0x8e, 0x9d, 0x1, 0x25, 0x83, 0x57, 0x5f,
1305 0x51, 0xe6, 0xe1, 0xa4, 0x4f, 0xf6, 0x81, 0xd7,
1306 0xe6, 0x98, 0x29, 0x98, 0x58, 0xfe, 0xda, 0x45,
1307 0xab, 0x38, 0x6, 0x91, 0x97, 0xb7, 0xa3, 0x4f,
1308 0x93, 0x8d, 0x8a, 0x8b, 0x5, 0xe9, 0x5, 0x98,
1309 0x3b, 0xc4, 0xb7, 0xe1, 0x68, 0x58, 0xa0, 0x3b,
1310 0x99, 0xea, 0x8a, 0xa9, 0xfb, 0x55, 0xe2, 0xc7,
1311 0x1d, 0x87, 0x3, 0x40, 0x24, 0x13, 0x28, 0x6a,
1312 0x34, 0x8a, 0xff, 0x62, 0x91, 0xb8, 0x7d, 0x28,
1313 0x1a, 0xd2, 0xfc, 0x4e, 0xa3, 0xda, 0x66, 0x69,
1314 0x15, 0xc0, 0xda, 0x15, 0x3e, 0x67, 0x12, 0x95,
1315 0x6, 0x1b, 0xf4, 0x60, 0xe4, 0x39, 0x82, 0xe9,
1316 0x2e, 0xbe, 0xab, 0x8c, 0x2c, 0x6e, 0xd6, 0x40,
1317 0x91, 0xc0, 0x68, 0xf7, 0xa2, 0x41, 0xd0, 0xa8,
1318 0x7, 0xab, 0x13, 0x34, 0x16, 0xf4, 0x73, 0x4f,
1319 0x1d, 0x21, 0x1a, 0x7d, 0xad, 0x43, 0x12, 0xf,
1320 0xb7, 0xfe, 0xa3, 0x81, 0xe9, 0xb5, 0x2d, 0xd3,
1321 0xa, 0x29, 0xb5, 0x32, 0xcb, 0x49, 0x6f, 0x1,
1322 0x90, 0x45, 0x62, 0xca, 0x1b, 0x66, 0x39, 0x88,
1323 0x1c, 0xee, 0x30, 0xa8, 0xb5, 0x37, 0xd0, 0xfa,
1324 0x46, 0x52, 0x16, 0x30, 0x17, 0xcf, 0x88, 0xd0,
1325 0x4, 0x5d, 0xde, 0x5e, 0x4f, 0xe7, 0xa9, 0xbf,
1326 0x3c, 0x29, 0x3a, 0x63, 0x67, 0x23, 0xb3, 0x7c,
1327 0x51, 0x17, 0xfe, 0x8d, 0xdb, 0xc8, 0x8d, 0x70,
1328 0xe9, 0x6f, 0x56, 0xe5, 0x44, 0xb2, 0x94, 0xeb,
1329 0x47, 0xca, 0x3a, 0xdc, 0xe3, 0x33, 0x87, 0x9c,
1330 0xe8, 0x89, 0x4b, 0x41, 0xb8, 0xb3, 0x69, 0xb0,
1331 0x7f, 0xc8, 0xc7, 0x74, 0xf5, 0xcb, 0x20, 0xad,
1332 0xea, 0xbb, 0x3d, 0x11, 0xc6, 0xc0, 0xd2, 0x88,
1333 0x8b, 0x16, 0xee, 0x62, 0x5a, 0x4d, 0x32, 0xe7,
1334 0x48, 0xae, 0xab, 0x5e, 0xc2, 0x83, 0xc4, 0xfc,
1335 0xd1, 0xb9, 0x71, 0xf2, 0x9, 0x7f, 0xdc, 0xbc,
1336 0x28, 0x74, 0xa0, 0x37, 0xa9, 0x5b, 0x6c, 0x7c,
1337 0x9b, 0x61, 0x94, 0x88, 0xf7, 0x40, 0x84, 0x75,
1338 0xa5, 0x50, 0xab, 0xb0, 0x92, 0x66, 0x10, 0x66,
1339 0xf6, 0xec, 0x6b, 0x5e, 0x31, 0x9b, 0xc4, 0xfa,
1340 0x95, 0x8b, 0xe7, 0xd4, 0xba, 0x81, 0xd2, 0x85,
1341 0x30, 0x4, 0x8b, 0x3d, 0xfa, 0x8a, 0x8f, 0x9b,
1342 0x54, 0x6a, 0x4d, 0x35, 0xa2, 0xe9, 0x58, 0x95,
1343 0xe3, 0xd1, 0x71, 0xcd, 0x3a, 0x54, 0xae, 0xd9,
1344 0x5c, 0x83, 0xd, 0x15, 0x64, 0x66, 0xee, 0x39,
1345 0xa1, 0x85, 0xe2, 0x28, 0xf5, 0x66, 0x5f, 0xec,
1346 0x39, 0x70, 0x96, 0x2c, 0x72, 0x9e, 0x57, 0xfd,
1347 0x57, 0x27, 0xb7, 0xda, 0x79, 0x39, 0xd8, 0x3b,
1348 0x2e, 0xa3, 0xb0, 0xde, 0xbf, 0x60, 0xb6, 0x42,
1349 0x78, 0x9d, 0x8f, 0xe8, 0x1c, 0x7c, 0x45, 0x72,
1350 0x3, 0xc4, 0xd5, 0x81, 0xf6, 0xe6, 0x9, 0x29,
1351 0x1e, 0xcd, 0xf3, 0xe, 0xd6, 0x65, 0xee, 0x6d,
1352 0x90, 0x17, 0x95, 0x20, 0x54, 0xf1, 0xd, 0x2f,
1353 0xa0, 0xac, 0xe3, 0x4b, 0xfc, 0xa4, 0xdc, 0xab,
1354 0x9d, 0x9e, 0x32, 0x63, 0x72, 0xd1, 0xb4, 0xef,
1355 0xf1, 0x83, 0xa7, 0xd7, 0x2b, 0x1a, 0x9a, 0x9e,
1356 0xfa, 0x1e, 0xb, 0x2b, 0xdc, 0x7b, 0x87, 0x96,
1357 0xf, 0xdb, 0x75, 0xb9, 0x6, 0x2b, 0xd3, 0x95,
1358 0xc5, 0xb3, 0x9, 0x53, 0x94, 0x54, 0x1f, 0xd0,
1359 0x75, 0x5a, 0x36, 0x6a, 0x7c, 0x82, 0xdb, 0xb1,
1360 0xa2, 0x17, 0xbc, 0xeb, 0x1f, 0xfa, 0x34, 0x3d,
1361 0xee, 0x68, 0xee, 0x93, 0x33, 0xfb, 0xcb, 0xd2,
1362 0xa3, 0xd1, 0x24, 0x5e, 0xf4, 0x9, 0xbe, 0x5a,
1363 0x68, 0x9e, 0x3e, 0xd4, 0x81, 0xcd, 0xa3, 0x1e,
1364 0x2, 0x13, 0xb4, 0x79, 0x94, 0xc9, 0xb2, 0xde,
1365 0x56, 0xf1, 0x7b, 0x2f, 0xe2, 0x56, 0xe1, 0x10,
1366 0xf4, 0x73, 0x2d, 0xc9, 0xca, 0x4d, 0x5f, 0x11,
1367 0x9e, 0xd6, 0x3c, 0x73, 0x12, 0x57, 0xe9, 0x14,
1368 0xe0, 0x8d, 0xdd, 0x4b, 0x8a, 0xbb, 0xb3, 0x78,
1369 0xbe, 0x16, 0x94, 0x93, 0x51, 0x33, 0x7a, 0xa5,
1370 0x41, 0x14, 0x60, 0x82, 0x94, 0x67, 0x70, 0xea,
1371 0xe6, 0x3, 0x7f, 0xc5, 0xa0, 0x20, 0x15, 0x88,
1372 0x53, 0xe3, 0x7e, 0x16, 0x52, 0xe4, 0xca, 0xa0,
1373 0x6f, 0xb9, 0x68, 0x4e, 0x30, 0xb9, 0x8c, 0xe6,
1374 0x9c, 0x5e, 0xc2, 0x93, 0xf9, 0xe1, 0x41, 0x4b,
1375 0x18, 0x42, 0x6f, 0x8f, 0x96, 0x3d, 0x2b, 0x28,
1376 0xd5, 0x53, 0x62, 0xdd, 0x6b, 0xd0, 0xf8, 0x2e,
1377 0xa6, 0x97, 0xe5, 0x87, 0xc5, 0xf6, 0x96, 0x7b,
1378 0xc4, 0x3e, 0x84, 0xc9, 0xf6, 0x34, 0x63, 0x46,
1379 0xe1, 0x10, 0xa5, 0x91, 0x6b, 0xff, 0x10, 0x3f,
1380 0x50, 0x2e, 0xd7, 0x39, 0x12, 0x7a, 0x15, 0x85,
1381 0xed, 0x99, 0xdb, 0x9b, 0x99, 0x6b, 0xfa, 0xfa,
1382 0x93, 0x7, 0x44, 0xbe, 0xbe, 0x60, 0x23, 0xc1,
1383 0xec, 0x5c, 0xf6, 0x93, 0x38, 0xf9, 0x89, 0x0,
1384 0xc5, 0x5f, 0x5b, 0xe2, 0x9d, 0x2b, 0xea, 0x6b,
1385 0x2e, 0xee, 0xb7, 0x4a, 0x4e, 0x8d, 0xd0, 0x35,
1386 0xe9, 0xc1, 0x5, 0x2b, 0x83, 0xb7, 0x72, 0x25,
1387 0xbb, 0xbe, 0xe8, 0x15, 0xf4, 0x74, 0x69, 0x69,
1388 0x67, 0x8c, 0x5c, 0x31, 0x79, 0x78, 0x2e, 0x43,
1389 0x83, 0xd1, 0xdd, 0x9, 0xc3, 0xa1, 0x0, 0x13,
1390 0x31, 0x4b, 0x86, 0xce, 0xee, 0xd7, 0xec, 0xb1,
1391 0x2c, 0x38, 0x46, 0x68, 0x62, 0xd9, 0x84, 0xdb,
1392 0x24, 0x62, 0x82, 0xc, 0x12, 0xb7, 0x4f, 0x86,
1393 0x54, 0x18, 0xc6, 0xd7, 0x94, 0x8b, 0xf2, 0x4c,
1394 0x17, 0x98, 0xaa, 0xe0,
1395 };
1396
1397 const uint8_t expected_cipher_long_input_end[] = {
1398 0x05, 0x95, 0x58, 0x7b, 0xb4, 0x60, 0x15,
1399 0x32, 0x9f, 0x38, 0xcc, 0x98, 0x1b, 0xbe, 0x10, 0xa5, 0x06, 0x67, 0xae, 0x38,
1400 0xbd, 0x7d, 0xb5, 0xcd, 0x58, 0x32, 0xdd, 0x9e,
1401 0x6a, 0xde, 0xe3, 0x53,
1402 };
1403
aes_ext_flash_ctr_test(uint32_t output_buf_caps)1404 void aes_ext_flash_ctr_test(uint32_t output_buf_caps)
1405 {
1406 mbedtls_aes_context ctx;
1407 uint8_t nonce[16];
1408 uint8_t key[16];
1409 uint8_t stream_block[16];
1410 size_t SZ = sizeof(long_input);
1411 memset(nonce, 0x2F, 16);
1412 memset(key, 0x1E, 16);
1413
1414 uint8_t *chipertext = heap_caps_malloc(SZ, output_buf_caps);
1415 uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
1416
1417 TEST_ASSERT_NOT_NULL(chipertext);
1418 TEST_ASSERT_NOT_NULL(decryptedtext);
1419
1420 mbedtls_aes_init(&ctx);
1421 mbedtls_aes_setkey_enc(&ctx, key, 128);
1422
1423 size_t offset;
1424
1425 // Encrypt with input buffer in external flash
1426 offset = 0;
1427 memset(nonce, 0x2F, 16);
1428 mbedtls_aes_crypt_ctr(&ctx, SZ, &offset, nonce, stream_block, long_input, chipertext);
1429 TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_long_input_end, chipertext + SZ - 32, 32);
1430
1431 // Decrypt
1432 offset = 0;
1433 memset(nonce, 0x2F, 16);
1434 // Decrypt with input buffer in external flash, the crypto DMA can't access this
1435 mbedtls_aes_crypt_ctr(&ctx, SZ, &offset, nonce, stream_block, chipertext, decryptedtext);
1436
1437 TEST_ASSERT_EQUAL_HEX8_ARRAY(long_input, decryptedtext, SZ);
1438
1439 mbedtls_aes_free(&ctx);
1440 free(chipertext);
1441 free(decryptedtext);
1442 }
1443
1444 /* Tests how crypto DMA handles data in external memory */
1445 TEST_CASE("mbedtls AES PSRAM tests", "[aes]")
1446 {
1447 aes_psram_ctr_test(MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
1448 aes_psram_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
1449 aes_psram_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
1450 aes_psram_one_buf_ctr_test();
1451 }
1452
1453 /* Tests how crypto DMA handles data from external flash */
1454 TEST_CASE("mbedtls AES external flash tests", "[aes]")
1455 {
1456 aes_ext_flash_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
1457 aes_ext_flash_ctr_test(MALLOC_CAP_DMA | MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
1458 }
1459 #endif // CONFIG_SPIRAM_USE_MALLOC
1460