26 #define MAC_STATE_SIZE sizeof( MAC_STATE )
34 #ifndef CONFIG_NO_SELFTEST
45 {
"\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B"
46 "\x0B\x0B\x0B\x0B", 20,
48 { 0xB6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
49 0xE2, 0x8B, 0xC0, 0xB6, 0xFB, 0x37, 0x8C, 0x8E,
50 0xF1, 0x46, 0xBE, 0x00 } },
52 "what do ya want for nothing?", 28,
53 { 0xEF, 0xFC, 0xDF, 0x6A, 0xE5, 0xEB, 0x2F, 0xA2,
54 0xD2, 0x74, 0x16, 0xD5, 0xF1, 0x84, 0xDF, 0x9C,
55 0x25, 0x9A, 0x7C, 0x79 } },
56 {
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
57 "\xAA\xAA\xAA\xAA", 20,
58 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
59 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
60 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
61 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
62 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD", 50,
63 { 0x12, 0x5D, 0x73, 0x42, 0xB9, 0xAC, 0x11, 0xCD,
64 0x91, 0xA3, 0x9A, 0xF4, 0x8A, 0xA1, 0x7B, 0x4F,
65 0x63, 0xF1, 0x75, 0xD3 } },
66 {
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10"
67 "\x11\x12\x13\x14\x15\x16\x17\x18\x19", 25,
68 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
69 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
70 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
71 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
72 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD", 50,
73 { 0x4C, 0x90, 0x07, 0xF4, 0x02, 0x62, 0x50, 0xC6,
74 0xBC, 0x84, 0x14, 0xF9, 0xBF, 0x50, 0xC8, 0x6C,
75 0x2D, 0x72, 0x35, 0xDA } },
77 {
"\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C\x0C"
78 "\x0C\x0C\x0C\x0C", 20,
79 "Test With Truncation", 20,
80 { 0x4C, 0x1A, 0x03, 0x42, 0x4B, 0x55, 0xE0, 0x7F,
81 0xE7, 0xF2, 0x7B, 0xE1, 0xD5, 0x8B, 0xB9, 0x32,
82 0x4A, 0x9A, 0x5A, 0x04 } },
84 {
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
85 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
86 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
87 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
88 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
89 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
90 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
91 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA", 80,
92 "Test Using Larger Than Block-Size Key - Hash Key First", 54,
93 { 0xAA, 0x4A, 0xE5, 0xE1, 0x52, 0x72, 0xD0, 0x0E,
94 0x95, 0x70, 0x56, 0x37, 0xCE, 0x8A, 0x3B, 0x55,
95 0xED, 0x40, 0x21, 0x12 } },
96 {
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
97 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
98 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
99 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
100 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
101 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
102 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
103 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA", 80,
104 "Test Using Larger Than Block-Size Key and Larger Than One "
105 "Block-Size Data", 73,
106 { 0xE8, 0xE9, 0x9D, 0x0F, 0x45, 0x23, 0x7D, 0x78,
107 0x6D, 0x6B, 0xBA, 0xA7, 0x96, 0x5C, 0x78, 0x08,
108 0xBB, 0xFF, 0x1A, 0x91 } },
109 {
"", 0, NULL, 0, { 0 } }
112 static int selfTest(
void )
119 for( i = 0; hmacValues[ i ].data != NULL; i++ )
121 status = testMAC( capabilityInfo, macState, hmacValues[ i ].
key,
131 #define selfTest NULL
148 assert( contextInfoPtr == NULL || \
150 assert( ( length == 0 &&
isWritePtr( data,
sizeof(
int ) ) ) || \
151 ( length > 0 &&
isWritePtr( data, length ) ) );
164 return( getDefaultInfo( type, contextInfoPtr, data, length ) );
177 MAC_INFO *macInfo = contextInfoPtr->ctxMAC;
204 memcpy( hashBuffer, macInfo->userKey,
230 MAC_INFO *macInfo = contextInfoPtr->ctxMAC;
255 if( macInfo->userKey != key )
256 memcpy( macInfo->userKey, key, keyLength );
263 memcpy( hashBuffer, macInfo->userKey,
287 selfTest, getInfo, NULL, NULL, initKey, NULL, hash, hash
292 return( &capabilityInfo );