1/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
2#include <assert.h>
3#include <stdlib.h>
4#include <string.h>
5
6#include <openssl/ssl.h>
7
8#include "lsquic_crypto.h"
9
10#ifdef WIN32
11#pragma warning(disable:4295 4245) //4295: array is too small to include a terminating null character, 4245:initializing': conversion from 'int' to 'unsigned char', signed/unsigned mismatch
12#endif
13
14struct export_key_test
15{
16    /* Line number for easy verification: */
17    int                 ekt_lineno;
18    /* Input: */
19    size_t              ekt_ikm_sz,
20                        ekt_salt_sz,
21                        ekt_context_sz;
22    unsigned char       ekt_ikm[0x20],
23                        ekt_salt[0x60],
24                        ekt_context[0x1000];
25    size_t              ekt_server_key_sz,
26                        ekt_server_iv_sz,
27                        ekt_client_key_sz,
28                        ekt_client_iv_sz;
29    /* Output: */
30    unsigned char       ekt_server_key[32],
31                        ekt_client_key[32],
32                        ekt_server_iv[4],
33                        ekt_client_iv[4];
34};
35
36
37static const struct export_key_test tests[] = {
38
39#define BUF_PAIR(name, buf) .ekt_##name = buf, .ekt_##name##_sz = sizeof(buf) - 1
40
41/* Convert using
42 *  sed '/^0x/{s/0x....: /"/; s~  .*~"~; s/ /\\x/g}'
43 */
44
45/*
46[0112/144512.438811:VERBOSE4:hkdf.cc(87)] secret:
470x0000:  73 65 63 72 65 74                                secret
48
49[0112/144512.438876:VERBOSE4:hkdf.cc(88)] salt:
500x0000:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
510x0010:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
52
53[0112/144512.438916:VERBOSE4:hkdf.cc(89)] info:
540x0000:  51 55 49 43 20 73 6f 75 72 63 65 20 61 64 64 72  QUIC.source.addr
550x0010:  65 73 73 20 74 6f 6b 65 6e 20 6b 65 79           ess.token.key
56
57[0112/144512.438983:VERBOSE4:hkdf.cc(103)] PRK:
580x0000:  18 10 e8 d3 41 b9 e6 1e 88 89 5f ba 0b 1a a2 bd  ....A....._.....
590x0010:  03 cb 6c 8f ff 2b 36 8e 66 6e f8 ef de f5 b4 fb  ..l..+6.fn......
60
61[0112/144512.439042:VERBOSE4:hkdf.cc(149)] client key:
620x0000:  59 58 f5 06 ac 1f f9 e6 2d 0b f9 77 df 05 c9 35  YX......-..w...5
63
64[0112/144512.439076:VERBOSE4:hkdf.cc(156)] server key:
650x0000:  45 ca 99 4a 40 bc e3 3b 32 16 59 51 98 36 d4 21  E..J@..;2.YQ.6.!
66 */
67    {
68        .ekt_lineno         = __LINE__,
69        .ekt_ikm            = "secret",
70        .ekt_ikm_sz         = 6,
71        BUF_PAIR(salt,
72            "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
73            "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
74            ),
75        BUF_PAIR(context, "QUIC source address token key"),
76        BUF_PAIR(client_key,
77            "\x59\x58\xf5\x06\xac\x1f\xf9\xe6\x2d\x0b\xf9\x77\xdf\x05\xc9\x35"
78            ),
79        BUF_PAIR(server_key,
80            "\x45\xca\x99\x4a\x40\xbc\xe3\x3b\x32\x16\x59\x51\x98\x36\xd4\x21"
81            ),
82    },
83
84/*
85[0112/144522.376235:VERBOSE4:hkdf.cc(87)] secret:
860x0000:  ab 62 c8 e1 03 63 b5 4e b9 c5 e4 f1 d9 47 ed 60  .b...c.N.....G.`
870x0010:  43 2f 3b c2 27 c3 2c 51 e7 7f e7 4b 5e a4 08 29  C/;.'.,Q...K^..)
88
89[0112/144522.376323:VERBOSE4:hkdf.cc(88)] salt:
900x0000:  58 77 dc d2 a5 d0 b3 7f 65 c3 cd 6b 03 a7 34 53  Xw......e..k..4S
910x0010:  d7 8b 6e 56 3c a0 22 a2 ab 7a 1e 4c 40 e9 cf d6  ..nV<."..z.L@...
920x0020:  02 2e ef d3 08 bc d1 be cb 70 f1 92 8e ec 27 7b  .........p....'{
930x0030:  b6 b5 27 ce ea 43 7d c2 34 b7 be 44 a3 89 70 9a  ..'..C}.4..D..p.
940x0040:  62 65 46 fa e5 86 44 04 fb 66 22 2d 7c 07 b8 b8  beF...D..f"-|...
95
96[0112/144522.376423:VERBOSE4:hkdf.cc(89)] info:
970x0000:  51 55 49 43 20 6b 65 79 20 65 78 70 61 6e 73 69  QUIC.key.expansi
980x0010:  6f 6e 00 a8 9f 60 a0 05 e6 1a 02 43 48 4c 4f 18  on...`.....CHLO.
990x0020:  00 00 00 50 41 44 00 01 02 00 00 53 4e 49 00 10  ...PAD.....SNI..
1000x0030:  02 00 00 53 54 4b 00 44 02 00 00 53 4e 4f 00 74  ...STK.D...SNO.t
1010x0040:  02 00 00 56 45 52 00 78 02 00 00 43 43 53 00 88  ...VER.x...CCS..
1020x0050:  02 00 00 4e 4f 4e 43 a8 02 00 00 4d 53 50 43 ac  ...NONC....MSPC.
1030x0060:  02 00 00 41 45 41 44 b0 02 00 00 53 43 49 44 c0  ...AEAD....SCID.
1040x0070:  02 00 00 50 44 4d 44 c4 02 00 00 53 4d 48 4c c8  ...PDMD....SMHL.
1050x0080:  02 00 00 49 43 53 4c cc 02 00 00 43 54 49 4d d4  ...ICSL....CTIM.
1060x0090:  02 00 00 4e 4f 4e 50 f4 02 00 00 50 55 42 53 14  ...NONP....PUBS.
1070x00a0:  03 00 00 4d 49 44 53 18 03 00 00 53 43 4c 53 1c  ...MIDS....SCLS.
1080x00b0:  03 00 00 4b 45 58 53 20 03 00 00 58 4c 43 54 28  ...KEXS....XLCT(
1090x00c0:  03 00 00 43 53 43 54 28 03 00 00 43 43 52 54 30  ...CSCT(...CCRT0
1100x00d0:  03 00 00 43 46 43 57 34 03 00 00 53 46 43 57 38  ...CFCW4...SFCW8
1110x00e0:  03 00 00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ...-------------
1120x00f0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1130x0100:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1140x0110:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1150x0120:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1160x0130:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1170x0140:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1180x0150:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1190x0160:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1200x0170:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1210x0180:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1220x0190:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1230x01a0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1240x01b0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1250x01c0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1260x01d0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1270x01e0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1280x01f0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1290x0200:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1300x0210:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1310x0220:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1320x0230:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1330x0240:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1340x0250:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1350x0260:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1360x0270:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1370x0280:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1380x0290:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1390x02a0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1400x02b0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1410x02c0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1420x02d0:  2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1430x02e0:  2d 2d 2d 2d 77 77 77 2e 65 78 61 6d 70 6c 65 2e  ----www.example.
1440x02f0:  6f 72 67 2f 22 e6 5d e0 f8 78 94 5a 23 2d ba b4  org/".]..x.Z#-..
1450x0300:  d7 e8 aa 1a 46 21 20 20 94 7f 0d 7a 5e 2e 41 98  ....F!.....z^.A.
1460x0310:  66 0e 44 88 eb f3 41 c5 b1 e2 65 a7 38 01 3c 2c  f.D...A...e.8.<,
1470x0320:  0d eb 00 2b 73 48 da 02 2e ef d3 08 bc d1 be cb  ...+sH..........
1480x0330:  70 f1 92 8e ec 27 7b b6 b5 27 ce ea 43 7d c2 34  p....'{..'..C}.4
1490x0340:  b7 be 44 a3 89 70 9a 62 65 46 fa e5 86 44 04 fb  ..D..p.beF...D..
1500x0350:  66 22 2d 7c 07 b8 b8 51 30 33 37 01 e8 81 60 92  f"-|...Q037...`.
1510x0360:  92 1a e8 7e ed 80 86 a2 15 82 91 58 77 dc d2 a5  ...~.......Xw...
1520x0370:  d0 b3 7f 65 c3 cd 6b 03 a7 34 53 d7 8b 6e 56 3c  ...e..k..4S..nV<
1530x0380:  a0 22 a2 ab 7a 1e 4c 40 e9 cf d6 64 00 00 00 43  ."..z.L@...d...C
1540x0390:  43 32 30 08 68 02 10 36 fa fb 68 b3 8a aa a4 e7  C20.h..6..h.....
1550x03a0:  96 41 ca 58 35 30 39 01 00 00 00 58 02 00 00 d2  .A.X509....X....
1560x03b0:  dc 77 58 00 00 00 00 2d c8 07 0e 2a 4b 39 15 ae  .wX....-...*K9..
1570x03c0:  98 1f 5c b1 6f ac 77 0e f7 ea dd 57 93 8b 38 f2  ..\.o.w....W..8.
1580x03d0:  8a 45 f5 d3 01 c1 9b a5 79 21 45 36 4f c6 f6 83  .E......y!E6O...
1590x03e0:  bc ba 1d e5 06 c1 8e 69 4c b6 e2 99 35 17 a1 ca  .......iL...5...
1600x03f0:  f0 d2 82 d9 a5 b0 3e 64 00 00 00 01 00 00 00 43  ......>d.......C
1610x0400:  32 35 35 b4 e2 9f fc ab 17 f2 4a b4 e2 9f fc ab  255.......J.....
1620x0410:  17 f2 4a 00 00 f0 00 00 00 60 00 53 43 46 47 06  ..J......`.SCFG.
1630x0420:  00 00 00 41 45 41 44 08 00 00 00 53 43 49 44 18  ...AEAD....SCID.
1640x0430:  00 00 00 50 55 42 53 3b 00 00 00 4b 45 58 53 3f  ...PUBS;...KEXS?
1650x0440:  00 00 00 4f 42 49 54 47 00 00 00 45 58 50 59 4f  ...OBITG...EXPYO
1660x0450:  00 00 00 41 45 53 47 43 43 32 30 08 68 02 10 36  ...AESGCC20.h..6
1670x0460:  fa fb 68 b3 8a aa a4 e7 96 41 ca 20 00 00 f6 00  ..h......A......
1680x0470:  dd 9e 3e 30 4f d9 fb 26 77 4e ce 35 79 6d 98 6d  ..>0O..&wN.5ym.m
1690x0480:  9a e6 a5 19 c0 b8 72 66 cd 46 b1 b6 90 4a 43 32  ......rf.F...JC2
1700x0490:  35 35 a5 d0 b3 7f 65 c3 cd 6b c8 2a 65 59 00 00  55....e..k.*eY..
1710x04a0:  00 00 30 82 03 b4 30 82 02 9c a0 03 02 01 02 02  ..0...0.........
1720x04b0:  01 01 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05  ..0...*.H.......
1730x04c0:  00 30 1e 31 1c 30 1a 06 03 55 04 03 0c 13 51 55  .0.1.0...U....QU
1740x04d0:  49 43 20 53 65 72 76 65 72 20 52 6f 6f 74 20 43  IC.Server.Root.C
1750x04e0:  41 30 1e 17 0d 31 36 31 32 32 32 32 31 32 39 30  A0...16122221290
1760x04f0:  34 5a 17 0d 31 36 31 32 32 35 32 31 32 39 30 34  4Z..161225212904
1770x0500:  5a 30 64 31 0b 30 09 06 03 55 04 06 13 02 55 53  Z0d1.0...U....US
1780x0510:  31 13 30 11 06 03 55 04 08 0c 0a 43 61 6c 69 66  1.0...U....Calif
1790x0520:  6f 72 6e 69 61 31 16 30 14 06 03 55 04 07 0c 0d  ornia1.0...U....
1800x0530:  4d 6f 75 6e 74 61 69 6e 20 56 69 65 77 31 14 30  Mountain.View1.0
1810x0540:  12 06 03 55 04 0a 0c 0b 51 55 49 43 20 53 65 72  ...U....QUIC.Ser
1820x0550:  76 65 72 31 12 30 10 06 03 55 04 03 0c 09 31 32  ver1.0...U....12
1830x0560:  37 2e 30 2e 30 2e 31 30 82 01 22 30 0d 06 09 2a  7.0.0.10.."0...*
1840x0570:  86 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30  .H.............0
1850x0580:  82 01 0a 02 82 01 01 00 f0 55 bf b6 81 96 69 f3  .........U....i.
1860x0590:  7a 06 f7 68 89 af fe 9c 30 e9 bb e7 0d 9b 37 c1  z..h....0.....7.
1870x05a0:  f6 a0 b8 28 72 bc 53 8e 8c 2c 99 a0 63 fe 7e 84  ...(r.S..,..c.~.
1880x05b0:  cb 35 11 96 24 98 20 ee 22 59 53 61 47 aa bc 66  .5..$..."YSaG..f
1890x05c0:  8f 05 4f ec b6 a7 9c 3c fb de a7 24 3f d8 fd 97  ..O....<...$?...
1900x05d0:  a8 79 50 80 86 11 3a a8 a4 1e fa 7b 1e cf 4b 5c  .yP...:....{..K\
1910x05e0:  7e 1c 23 5b b2 e1 d4 d7 ca 32 6e 4c 74 01 42 f0  ~.#[.....2nLt.B.
1920x05f0:  36 14 09 f8 c7 22 6f 13 69 4a 32 9d e1 33 36 1b  6...."o.iJ2..36.
1930x0600:  e6 4d 74 6c b8 fa 49 f0 9a 0d 81 9f c6 b8 88 79  .Mtl..I........y
1940x0610:  70 6c 0c 1c fb f9 70 27 e8 c1 c7 dd ba d0 97 f9  pl....p'........
1950x0620:  ca 1a 1f 24 64 3b f7 3d 4c 67 b1 e2 87 07 f9 a2  ...$d;.=Lg......
1960x0630:  b8 d5 82 06 80 cd 1f 97 ca 4b 39 87 4f 0a b7 a7  .........K9.O...
1970x0640:  36 cf f2 fe 08 7b 46 7d 25 61 f5 ec 18 13 f5 e1  6....{F}%a......
1980x0650:  4b a9 eb ec a8 53 7f ad 66 19 fb 22 70 cc fa df  K....S..f.."p...
1990x0660:  64 da f4 b1 07 17 3d b0 0f d7 0d df fe e8 9b 3a  d.....=........:
2000x0670:  86 fc a0 85 d1 03 a3 4d 89 9c cc de c6 c6 de 9a  .......M........
2010x0680:  d0 f3 7f 6d 1d 0a 8e 27 02 03 01 00 01 a3 81 b6  ...m...'........
2020x0690:  30 81 b3 30 0c 06 03 55 1d 13 01 01 ff 04 02 30  0..0...U.......0
2030x06a0:  00 30 1d 06 03 55 1d 0e 04 16 04 14 1a 79 b5 96  .0...U.......y..
2040x06b0:  b0 18 f3 1a 21 fd 8c 82 30 b9 af 94 60 d1 62 fe  ....!...0...`.b.
2050x06c0:  30 1f 06 03 55 1d 23 04 18 30 16 80 14 f2 38 71  0...U.#..0....8q
2060x06d0:  39 4b 66 26 ac 8c 4b 3e cc 03 88 d7 55 1f aa 5d  9Kf&..K>....U..]
2070x06e0:  92 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06  .0...U.%..0...+.
2080x06f0:  01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02  ........+.......
2090x0700:  30 44 06 03 55 1d 11 04 3d 30 3b 82 0f 77 77 77  0D..U...=0;..www
2100x0710:  2e 65 78 61 6d 70 6c 65 2e 6f 72 67 82 10 6d 61  .example.org..ma
2110x0720:  69 6c 2e 65 78 61 6d 70 6c 65 2e 6f 72 67 82 10  il.example.org..
2120x0730:  6d 61 69 6c 2e 65 78 61 6d 70 6c 65 2e 63 6f 6d  mail.example.com
2130x0740:  87 04 7f 00 00 01 30 0d 06 09 2a 86 48 86 f7 0d  ......0...*.H...
2140x0750:  01 01 0b 05 00 03 82 01 01 00 68 24 9a 07 f7 b8  ..........h$....
2150x0760:  7d 96 ef fd e5 0c 7c 2c 31 a8 95 e2 fa 05 a7 3e  }.....|,1......>
2160x0770:  98 3b 77 3c 0a e1 a2 16 51 7f 58 43 82 6c c4 66  .;w<....Q.XC.l.f
2170x0780:  f3 88 26 17 bd e5 d3 b1 84 2a b7 cf e1 d1 b2 85  ..&......*......
2180x0790:  3b fc 20 1a df 1d 24 f5 dc 58 b7 ef 36 72 9f d7  ;.....$..X..6r..
2190x07a0:  da c5 f4 46 08 4b 17 64 99 1a b1 1e de 68 00 74  ...F.K.d.....h.t
2200x07b0:  4c 1a 7c 55 b9 7f c3 2d fa 58 3b 6b 93 5a 0a 43  L.|U...-.X;k.Z.C
2210x07c0:  e3 41 4e 4e 5c 2c a6 0c cf 17 c4 86 ea 58 37 a2  .ANN\,.......X7.
2220x07d0:  40 de 22 eb ad 07 77 05 cb 57 df 49 56 96 f7 d4  @."...w..W.IV...
2230x07e0:  a6 9a ac 65 c9 2e 0e dc 53 14 6c 1d 41 68 22 8d  ...e....S.l.Ah".
2240x07f0:  1f 40 49 6d b2 a7 6c 26 a5 60 52 a7 aa 8a 57 0c  .@Im..l&.`R...W.
2250x0800:  d6 45 54 5b 18 75 00 c2 cb 64 ae 66 45 0d 96 67  .ET[.u...d.fE..g
2260x0810:  0b 6d 11 c6 51 b5 2b e3 e8 68 2d 60 91 b0 bc 3c  .m..Q.+..h-`...<
2270x0820:  03 69 99 06 9f 16 e4 a8 b9 8c ac 04 9f 1f e9 0a  .i..............
2280x0830:  81 eb 60 ae 27 6d 87 f7 0b cf 9c bb 1a db 15 8a  ..`.'m..........
2290x0840:  92 08 28 5a ac 9d 37 2c 35 f2 c1 bb e6 01 4a f6  ..(Z..7,5.....J.
2300x0850:  4b 67 f5 ec 1f 1f a7 04 9b 21                    Kg.......!
231
232[0112/144522.378102:VERBOSE4:hkdf.cc(103)] PRK:
2330x0000:  76 54 6a 15 79 39 65 66 5c 63 0d a9 85 d9 f8 89  vTj.y9ef\c......
2340x0010:  a7 a5 c5 41 62 e0 6c 26 fb 42 32 30 3d 0a 32 80  ...Ab.l&.B20=.2.
235
236[0112/144522.378351:VERBOSE4:hkdf.cc(149)] client key:
2370x0000:  52 79 c1 44 f0 8d 83 99 6b f3 b6 83 11 ff 31 25  Ry.D....k.....1%
2380x0010:  86 79 d6 af 62 bc b3 71 1d 7e fa 71 35 9f f2 aa  .y..b..q.~.q5...
239
240[0112/144522.378422:VERBOSE4:hkdf.cc(156)] server key:
2410x0000:  bf 3d 5e 92 6e 8f 09 15 3f 0b f3 0b 91 e8 84 50  .=^.n...?......P
2420x0010:  73 33 81 86 be 9c 32 56 d7 b2 6a 57 67 80 46 fd  s3....2V..jWg.F.
243
244[0112/144522.378489:VERBOSE4:hkdf.cc(163)] client IV:
2450x0000:  a1 c0 66 60                                      ..f`
246
247[0112/144522.378549:VERBOSE4:hkdf.cc(170)] server IV:
2480x0000:  fa 93 8b 39                                      ...9
249
250[0112/144522.378594:VERBOSE4:hkdf.cc(176)] subkey secret:
2510x0000:  55 3a eb 1e 23 82 a7 6b a6 22 a9 c8 23 7d c7 11  U:..#..k."..#}..
2520x0010:  7e 35 ca c8 c8 26 8c 36 cb 75 78 18 58 c5 d3 3a  ~5...&.6.ux.X..:
253*/
254    {
255        .ekt_lineno         = __LINE__,
256        BUF_PAIR(ikm,
257            "\xab\x62\xc8\xe1\x03\x63\xb5\x4e\xb9\xc5\xe4\xf1\xd9\x47\xed\x60"
258            "\x43\x2f\x3b\xc2\x27\xc3\x2c\x51\xe7\x7f\xe7\x4b\x5e\xa4\x08\x29"
259            ),
260        BUF_PAIR(salt,
261            "\x58\x77\xdc\xd2\xa5\xd0\xb3\x7f\x65\xc3\xcd\x6b\x03\xa7\x34\x53"
262            "\xd7\x8b\x6e\x56\x3c\xa0\x22\xa2\xab\x7a\x1e\x4c\x40\xe9\xcf\xd6"
263            "\x02\x2e\xef\xd3\x08\xbc\xd1\xbe\xcb\x70\xf1\x92\x8e\xec\x27\x7b"
264            "\xb6\xb5\x27\xce\xea\x43\x7d\xc2\x34\xb7\xbe\x44\xa3\x89\x70\x9a"
265            "\x62\x65\x46\xfa\xe5\x86\x44\x04\xfb\x66\x22\x2d\x7c\x07\xb8\xb8"
266            ),
267        BUF_PAIR(context,
268            "\x51\x55\x49\x43\x20\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69"
269            "\x6f\x6e\x00\xa8\x9f\x60\xa0\x05\xe6\x1a\x02\x43\x48\x4c\x4f\x18"
270            "\x00\x00\x00\x50\x41\x44\x00\x01\x02\x00\x00\x53\x4e\x49\x00\x10"
271            "\x02\x00\x00\x53\x54\x4b\x00\x44\x02\x00\x00\x53\x4e\x4f\x00\x74"
272            "\x02\x00\x00\x56\x45\x52\x00\x78\x02\x00\x00\x43\x43\x53\x00\x88"
273            "\x02\x00\x00\x4e\x4f\x4e\x43\xa8\x02\x00\x00\x4d\x53\x50\x43\xac"
274            "\x02\x00\x00\x41\x45\x41\x44\xb0\x02\x00\x00\x53\x43\x49\x44\xc0"
275            "\x02\x00\x00\x50\x44\x4d\x44\xc4\x02\x00\x00\x53\x4d\x48\x4c\xc8"
276            "\x02\x00\x00\x49\x43\x53\x4c\xcc\x02\x00\x00\x43\x54\x49\x4d\xd4"
277            "\x02\x00\x00\x4e\x4f\x4e\x50\xf4\x02\x00\x00\x50\x55\x42\x53\x14"
278            "\x03\x00\x00\x4d\x49\x44\x53\x18\x03\x00\x00\x53\x43\x4c\x53\x1c"
279            "\x03\x00\x00\x4b\x45\x58\x53\x20\x03\x00\x00\x58\x4c\x43\x54\x28"
280            "\x03\x00\x00\x43\x53\x43\x54\x28\x03\x00\x00\x43\x43\x52\x54\x30"
281            "\x03\x00\x00\x43\x46\x43\x57\x34\x03\x00\x00\x53\x46\x43\x57\x38"
282            "\x03\x00\x00\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
283            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
284            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
285            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
286            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
287            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
288            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
289            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
290            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
291            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
292            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
293            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
294            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
295            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
296            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
297            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
298            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
299            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
300            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
301            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
302            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
303            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
304            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
305            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
306            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
307            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
308            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
309            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
310            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
311            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
312            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
313            "\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d\x2d"
314            "\x2d\x2d\x2d\x2d\x77\x77\x77\x2e\x65\x78\x61\x6d\x70\x6c\x65\x2e"
315            "\x6f\x72\x67\x2f\x22\xe6\x5d\xe0\xf8\x78\x94\x5a\x23\x2d\xba\xb4"
316            "\xd7\xe8\xaa\x1a\x46\x21\x20\x20\x94\x7f\x0d\x7a\x5e\x2e\x41\x98"
317            "\x66\x0e\x44\x88\xeb\xf3\x41\xc5\xb1\xe2\x65\xa7\x38\x01\x3c\x2c"
318            "\x0d\xeb\x00\x2b\x73\x48\xda\x02\x2e\xef\xd3\x08\xbc\xd1\xbe\xcb"
319            "\x70\xf1\x92\x8e\xec\x27\x7b\xb6\xb5\x27\xce\xea\x43\x7d\xc2\x34"
320            "\xb7\xbe\x44\xa3\x89\x70\x9a\x62\x65\x46\xfa\xe5\x86\x44\x04\xfb"
321            "\x66\x22\x2d\x7c\x07\xb8\xb8\x51\x30\x33\x37\x01\xe8\x81\x60\x92"
322            "\x92\x1a\xe8\x7e\xed\x80\x86\xa2\x15\x82\x91\x58\x77\xdc\xd2\xa5"
323            "\xd0\xb3\x7f\x65\xc3\xcd\x6b\x03\xa7\x34\x53\xd7\x8b\x6e\x56\x3c"
324            "\xa0\x22\xa2\xab\x7a\x1e\x4c\x40\xe9\xcf\xd6\x64\x00\x00\x00\x43"
325            "\x43\x32\x30\x08\x68\x02\x10\x36\xfa\xfb\x68\xb3\x8a\xaa\xa4\xe7"
326            "\x96\x41\xca\x58\x35\x30\x39\x01\x00\x00\x00\x58\x02\x00\x00\xd2"
327            "\xdc\x77\x58\x00\x00\x00\x00\x2d\xc8\x07\x0e\x2a\x4b\x39\x15\xae"
328            "\x98\x1f\x5c\xb1\x6f\xac\x77\x0e\xf7\xea\xdd\x57\x93\x8b\x38\xf2"
329            "\x8a\x45\xf5\xd3\x01\xc1\x9b\xa5\x79\x21\x45\x36\x4f\xc6\xf6\x83"
330            "\xbc\xba\x1d\xe5\x06\xc1\x8e\x69\x4c\xb6\xe2\x99\x35\x17\xa1\xca"
331            "\xf0\xd2\x82\xd9\xa5\xb0\x3e\x64\x00\x00\x00\x01\x00\x00\x00\x43"
332            "\x32\x35\x35\xb4\xe2\x9f\xfc\xab\x17\xf2\x4a\xb4\xe2\x9f\xfc\xab"
333            "\x17\xf2\x4a\x00\x00\xf0\x00\x00\x00\x60\x00\x53\x43\x46\x47\x06"
334            "\x00\x00\x00\x41\x45\x41\x44\x08\x00\x00\x00\x53\x43\x49\x44\x18"
335            "\x00\x00\x00\x50\x55\x42\x53\x3b\x00\x00\x00\x4b\x45\x58\x53\x3f"
336            "\x00\x00\x00\x4f\x42\x49\x54\x47\x00\x00\x00\x45\x58\x50\x59\x4f"
337            "\x00\x00\x00\x41\x45\x53\x47\x43\x43\x32\x30\x08\x68\x02\x10\x36"
338            "\xfa\xfb\x68\xb3\x8a\xaa\xa4\xe7\x96\x41\xca\x20\x00\x00\xf6\x00"
339            "\xdd\x9e\x3e\x30\x4f\xd9\xfb\x26\x77\x4e\xce\x35\x79\x6d\x98\x6d"
340            "\x9a\xe6\xa5\x19\xc0\xb8\x72\x66\xcd\x46\xb1\xb6\x90\x4a\x43\x32"
341            "\x35\x35\xa5\xd0\xb3\x7f\x65\xc3\xcd\x6b\xc8\x2a\x65\x59\x00\x00"
342            "\x00\x00\x30\x82\x03\xb4\x30\x82\x02\x9c\xa0\x03\x02\x01\x02\x02"
343            "\x01\x01\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x0b\x05"
344            "\x00\x30\x1e\x31\x1c\x30\x1a\x06\x03\x55\x04\x03\x0c\x13\x51\x55"
345            "\x49\x43\x20\x53\x65\x72\x76\x65\x72\x20\x52\x6f\x6f\x74\x20\x43"
346            "\x41\x30\x1e\x17\x0d\x31\x36\x31\x32\x32\x32\x32\x31\x32\x39\x30"
347            "\x34\x5a\x17\x0d\x31\x36\x31\x32\x32\x35\x32\x31\x32\x39\x30\x34"
348            "\x5a\x30\x64\x31\x0b\x30\x09\x06\x03\x55\x04\x06\x13\x02\x55\x53"
349            "\x31\x13\x30\x11\x06\x03\x55\x04\x08\x0c\x0a\x43\x61\x6c\x69\x66"
350            "\x6f\x72\x6e\x69\x61\x31\x16\x30\x14\x06\x03\x55\x04\x07\x0c\x0d"
351            "\x4d\x6f\x75\x6e\x74\x61\x69\x6e\x20\x56\x69\x65\x77\x31\x14\x30"
352            "\x12\x06\x03\x55\x04\x0a\x0c\x0b\x51\x55\x49\x43\x20\x53\x65\x72"
353            "\x76\x65\x72\x31\x12\x30\x10\x06\x03\x55\x04\x03\x0c\x09\x31\x32"
354            "\x37\x2e\x30\x2e\x30\x2e\x31\x30\x82\x01\x22\x30\x0d\x06\x09\x2a"
355            "\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x00\x30"
356            "\x82\x01\x0a\x02\x82\x01\x01\x00\xf0\x55\xbf\xb6\x81\x96\x69\xf3"
357            "\x7a\x06\xf7\x68\x89\xaf\xfe\x9c\x30\xe9\xbb\xe7\x0d\x9b\x37\xc1"
358            "\xf6\xa0\xb8\x28\x72\xbc\x53\x8e\x8c\x2c\x99\xa0\x63\xfe\x7e\x84"
359            "\xcb\x35\x11\x96\x24\x98\x20\xee\x22\x59\x53\x61\x47\xaa\xbc\x66"
360            "\x8f\x05\x4f\xec\xb6\xa7\x9c\x3c\xfb\xde\xa7\x24\x3f\xd8\xfd\x97"
361            "\xa8\x79\x50\x80\x86\x11\x3a\xa8\xa4\x1e\xfa\x7b\x1e\xcf\x4b\x5c"
362            "\x7e\x1c\x23\x5b\xb2\xe1\xd4\xd7\xca\x32\x6e\x4c\x74\x01\x42\xf0"
363            "\x36\x14\x09\xf8\xc7\x22\x6f\x13\x69\x4a\x32\x9d\xe1\x33\x36\x1b"
364            "\xe6\x4d\x74\x6c\xb8\xfa\x49\xf0\x9a\x0d\x81\x9f\xc6\xb8\x88\x79"
365            "\x70\x6c\x0c\x1c\xfb\xf9\x70\x27\xe8\xc1\xc7\xdd\xba\xd0\x97\xf9"
366            "\xca\x1a\x1f\x24\x64\x3b\xf7\x3d\x4c\x67\xb1\xe2\x87\x07\xf9\xa2"
367            "\xb8\xd5\x82\x06\x80\xcd\x1f\x97\xca\x4b\x39\x87\x4f\x0a\xb7\xa7"
368            "\x36\xcf\xf2\xfe\x08\x7b\x46\x7d\x25\x61\xf5\xec\x18\x13\xf5\xe1"
369            "\x4b\xa9\xeb\xec\xa8\x53\x7f\xad\x66\x19\xfb\x22\x70\xcc\xfa\xdf"
370            "\x64\xda\xf4\xb1\x07\x17\x3d\xb0\x0f\xd7\x0d\xdf\xfe\xe8\x9b\x3a"
371            "\x86\xfc\xa0\x85\xd1\x03\xa3\x4d\x89\x9c\xcc\xde\xc6\xc6\xde\x9a"
372            "\xd0\xf3\x7f\x6d\x1d\x0a\x8e\x27\x02\x03\x01\x00\x01\xa3\x81\xb6"
373            "\x30\x81\xb3\x30\x0c\x06\x03\x55\x1d\x13\x01\x01\xff\x04\x02\x30"
374            "\x00\x30\x1d\x06\x03\x55\x1d\x0e\x04\x16\x04\x14\x1a\x79\xb5\x96"
375            "\xb0\x18\xf3\x1a\x21\xfd\x8c\x82\x30\xb9\xaf\x94\x60\xd1\x62\xfe"
376            "\x30\x1f\x06\x03\x55\x1d\x23\x04\x18\x30\x16\x80\x14\xf2\x38\x71"
377            "\x39\x4b\x66\x26\xac\x8c\x4b\x3e\xcc\x03\x88\xd7\x55\x1f\xaa\x5d"
378            "\x92\x30\x1d\x06\x03\x55\x1d\x25\x04\x16\x30\x14\x06\x08\x2b\x06"
379            "\x01\x05\x05\x07\x03\x01\x06\x08\x2b\x06\x01\x05\x05\x07\x03\x02"
380            "\x30\x44\x06\x03\x55\x1d\x11\x04\x3d\x30\x3b\x82\x0f\x77\x77\x77"
381            "\x2e\x65\x78\x61\x6d\x70\x6c\x65\x2e\x6f\x72\x67\x82\x10\x6d\x61"
382            "\x69\x6c\x2e\x65\x78\x61\x6d\x70\x6c\x65\x2e\x6f\x72\x67\x82\x10"
383            "\x6d\x61\x69\x6c\x2e\x65\x78\x61\x6d\x70\x6c\x65\x2e\x63\x6f\x6d"
384            "\x87\x04\x7f\x00\x00\x01\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d"
385            "\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x68\x24\x9a\x07\xf7\xb8"
386            "\x7d\x96\xef\xfd\xe5\x0c\x7c\x2c\x31\xa8\x95\xe2\xfa\x05\xa7\x3e"
387            "\x98\x3b\x77\x3c\x0a\xe1\xa2\x16\x51\x7f\x58\x43\x82\x6c\xc4\x66"
388            "\xf3\x88\x26\x17\xbd\xe5\xd3\xb1\x84\x2a\xb7\xcf\xe1\xd1\xb2\x85"
389            "\x3b\xfc\x20\x1a\xdf\x1d\x24\xf5\xdc\x58\xb7\xef\x36\x72\x9f\xd7"
390            "\xda\xc5\xf4\x46\x08\x4b\x17\x64\x99\x1a\xb1\x1e\xde\x68\x00\x74"
391            "\x4c\x1a\x7c\x55\xb9\x7f\xc3\x2d\xfa\x58\x3b\x6b\x93\x5a\x0a\x43"
392            "\xe3\x41\x4e\x4e\x5c\x2c\xa6\x0c\xcf\x17\xc4\x86\xea\x58\x37\xa2"
393            "\x40\xde\x22\xeb\xad\x07\x77\x05\xcb\x57\xdf\x49\x56\x96\xf7\xd4"
394            "\xa6\x9a\xac\x65\xc9\x2e\x0e\xdc\x53\x14\x6c\x1d\x41\x68\x22\x8d"
395            "\x1f\x40\x49\x6d\xb2\xa7\x6c\x26\xa5\x60\x52\xa7\xaa\x8a\x57\x0c"
396            "\xd6\x45\x54\x5b\x18\x75\x00\xc2\xcb\x64\xae\x66\x45\x0d\x96\x67"
397            "\x0b\x6d\x11\xc6\x51\xb5\x2b\xe3\xe8\x68\x2d\x60\x91\xb0\xbc\x3c"
398            "\x03\x69\x99\x06\x9f\x16\xe4\xa8\xb9\x8c\xac\x04\x9f\x1f\xe9\x0a"
399            "\x81\xeb\x60\xae\x27\x6d\x87\xf7\x0b\xcf\x9c\xbb\x1a\xdb\x15\x8a"
400            "\x92\x08\x28\x5a\xac\x9d\x37\x2c\x35\xf2\xc1\xbb\xe6\x01\x4a\xf6"
401            "\x4b\x67\xf5\xec\x1f\x1f\xa7\x04\x9b\x21"
402            ),
403        BUF_PAIR(client_key,
404            "\x52\x79\xc1\x44\xf0\x8d\x83\x99\x6b\xf3\xb6\x83\x11\xff\x31\x25"
405            "\x86\x79\xd6\xaf\x62\xbc\xb3\x71\x1d\x7e\xfa\x71\x35\x9f\xf2\xaa"
406            ),
407        BUF_PAIR(server_key,
408            "\xbf\x3d\x5e\x92\x6e\x8f\x09\x15\x3f\x0b\xf3\x0b\x91\xe8\x84\x50"
409            "\x73\x33\x81\x86\xbe\x9c\x32\x56\xd7\xb2\x6a\x57\x67\x80\x46\xfd"
410            ),
411        BUF_PAIR(client_iv, "\xa1\xc0\x66\x60"),
412        BUF_PAIR(server_iv, "\xfa\x93\x8b\x39"),
413/*
414[0112/144522.378594:VERBOSE4:hkdf.cc(176)] subkey secret:
415"\x55\x3a\xeb\x1e\x23\x82\xa7\x6b\xa6\x22\xa9\xc8\x23\x7d\xc7\x11"
416"\x7e\x35\xca\xc8\xc8\x26\x8c\x36\xcb\x75\x78\x18\x58\xc5\xd3\x3a"
417*/
418    },
419
420
421};
422
423
424static void
425run_ekt_test (const struct export_key_test *test)
426{
427    int s, i;
428
429    unsigned char   client_key[0x100],
430                    server_key[0x100],
431                    client_iv[0x100],
432                    server_iv[0x100];
433
434    unsigned char   sub_key[32];
435    unsigned char   c_hp[16], s_hp[16];
436
437    /* Sanity check the test itself: */
438    assert(test->ekt_client_key_sz < sizeof(client_key));
439    assert(test->ekt_server_key_sz < sizeof(server_key));
440    assert(test->ekt_server_iv_sz < sizeof(server_iv));
441    assert(test->ekt_client_iv_sz < sizeof(client_iv));
442
443    for (i = 0; i < 2; ++i)
444    {
445        if (i && !(test->ekt_ikm_sz == 32 && test->ekt_client_key_sz == 16 && test->ekt_server_key_sz == 16))
446            continue;
447        s = lsquic_export_key_material(test->ekt_ikm,       (uint32_t)test->ekt_ikm_sz,
448                                test->ekt_salt,             (int)test->ekt_salt_sz,
449                                test->ekt_context,          (uint32_t)test->ekt_context_sz,
450                                (uint16_t)test->ekt_client_key_sz,    client_key,
451                                (uint16_t)test->ekt_server_key_sz,    server_key,
452                                (uint16_t)test->ekt_client_iv_sz,     client_iv,
453                                (uint16_t)test->ekt_server_iv_sz,     server_iv,
454                                sub_key,
455                                /* Keys should not change because HP pointers are given */
456                                i ? c_hp : NULL,
457                                i ? s_hp : NULL
458                                );
459        assert(0 == s);     /* This function always returns zero */
460        if (test->ekt_client_key_sz)
461            assert(0 == memcmp(client_key, test->ekt_client_key,
462                                                        test->ekt_client_key_sz));
463        if (test->ekt_server_key_sz)
464            assert(0 == memcmp(server_key, test->ekt_server_key,
465                                                        test->ekt_server_key_sz));
466    }
467}
468
469
470int
471main (void)
472{
473    unsigned n;
474    for (n = 0; n < sizeof(tests) / sizeof(tests[0]); ++n)
475        run_ekt_test(&tests[n]);
476    return 0;
477}
478