25 MD5_CTX macState, initialMacState;
28 #define MAC_STATE_SIZE sizeof( MAC_STATE )
36 #ifndef CONFIG_NO_SELFTEST
48 {
"\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B", 16,
50 { 0x92, 0x94, 0x72, 0x7A, 0x36, 0x38, 0xBB, 0x1C,
51 0x13, 0xF4, 0x8E, 0xF8, 0x15, 0x8B, 0xFC, 0x9D } },
53 "what do ya want for nothing?", 28,
54 { 0x75, 0x0C, 0x78, 0x3E, 0x6A, 0xB0, 0xB5, 0x03,
55 0xEA, 0xA8, 0x6E, 0x31, 0x0A, 0x5D, 0xB7, 0x38 } },
56 {
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA", 16,
57 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
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", 50,
62 { 0x56, 0xBE, 0x34, 0x52, 0x1D, 0x14, 0x4C, 0x88,
63 0xDB, 0xB8, 0xC7, 0x33, 0xF0, 0xE8, 0xB3, 0xF6 } },
64 {
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10"
65 "\x11\x12\x13\x14\x15\x16\x17\x18\x19", 25,
66 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
67 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
68 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
69 "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xC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"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
95 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
96 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
97 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA", 80,
98 "Test Using Larger Than Block-Size Key and Larger Than One "
99 "Block-Size Data", 73,
100 { 0x6F, 0x63, 0x0F, 0xAD, 0x67, 0xCD, 0xA0, 0xEE,
101 0x1F, 0xB1, 0xF5, 0x62, 0xDB, 0x3A, 0xA5, 0x3E } },
102 {
"", 0, NULL, 0, { 0 } }
105 static int selfTest(
void )
112 for( i = 0; hmacValues[ i ].data != NULL; i++ )
114 status = testMAC( capabilityInfo, macState, hmacValues[ i ].
key,
124 #define selfTest NULL
141 assert( contextInfoPtr == NULL || \
143 assert( ( length == 0 &&
isWritePtr( data,
sizeof(
int ) ) ) || \
144 ( length > 0 &&
isWritePtr( data, length ) ) );
157 return( getDefaultInfo( type, contextInfoPtr, data, length ) );
170 MAC_INFO *macInfo = contextInfoPtr->ctxMAC;
196 memcpy( hashBuffer, macInfo->userKey,
222 MAC_INFO *macInfo = contextInfoPtr->ctxMAC;
247 if( macInfo->userKey != key )
248 memcpy( macInfo->userKey, key, keyLength );
255 memcpy( hashBuffer, macInfo->userKey,
279 selfTest, getInfo, NULL, NULL, initKey, NULL, hash, hash
284 return( &capabilityInfo );