forked from microsoft/SymCrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtlsprf_selftest.c
58 lines (47 loc) · 1.36 KB
/
tlsprf_selftest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// tlsprf_selftest.c
//
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
//
#include "precomp.h"
static const BYTE pbResult1_1[] =
{
0x8e, 0x7e, 0x7b, 0x2f, 0x7d, 0x00, 0x77, 0x09, 0x78, 0x22, 0x51, 0xf2, 0xcf,
};
static const BYTE pbResult1_2Sha512[] =
{
0xf9, 0x9f, 0x44, 0x4d, 0x26, 0xde, 0x8b, 0x4f, 0xc2, 0x81, 0x5b, 0x23, 0x70,
};
VOID
SYMCRYPT_CALL
SymCryptTlsPrf1_1SelfTest(void)
{
SYMCRYPT_ALIGN BYTE rbResult[sizeof(pbResult1_1)];
SymCryptTlsPrf1_1(
&SymCryptTestKey32[0], 15,
&SymCryptTestKey32[16], 16,
&SymCryptTestMsg3[0], 3,
rbResult, sizeof(pbResult1_1));
SymCryptInjectError(rbResult, sizeof(pbResult1_1));
if (memcmp(rbResult, pbResult1_1, sizeof(pbResult1_1)) != 0)
{
SymCryptFatal('tl11');
}
}
VOID
SYMCRYPT_CALL
SymCryptTlsPrf1_2SelfTest(void)
{
SYMCRYPT_ALIGN BYTE rbResult[sizeof(pbResult1_2Sha512)];
SymCryptTlsPrf1_2(
SymCryptHmacSha512Algorithm,
&SymCryptTestKey32[0], 15,
&SymCryptTestKey32[16], 16,
&SymCryptTestMsg3[0], 3,
rbResult, sizeof(pbResult1_2Sha512));
SymCryptInjectError(rbResult, sizeof(pbResult1_2Sha512));
if (memcmp(rbResult, pbResult1_2Sha512, sizeof(pbResult1_2Sha512)) != 0)
{
SymCryptFatal('tl12');
}
}