/*---------------------------------------------------------------------------* Project: NET demo File: digest.c Copyright (C) 2006 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Log: digest.c,v $ Revision 1.10 2006/10/11 04:29:16 yosizaki added USING_HMAC_CONTEXT switch. Revision 1.9 2006/08/29 07:07:02 seiki_masashi Changed so that NETCalcMD5 and NETCalcSHA1 are also used. Revision 1.8 2006/08/29 06:48:52 kitase_hirotake rename function Revision 1.7 2006/08/29 06:35:55 seiki_masashi Added test of HMAC-SHA1. Revision 1.6 2006/08/29 06:27:00 yosizaki small fix. Revision 1.5 2006/08/29 05:55:02 seiki_masashi Added test of SHA-1. Revision 1.4 2006/08/29 05:50:07 kitase_hirotake Added HMAC-MD5 test Revision 1.3 2006/08/28 08:20:58 seiki_masashi added MD5 tests Revision 1.2 2006/08/28 05:51:03 seiki_masashi Initial revision $NoKeywords: $ *---------------------------------------------------------------------------*/ #include #include #include #define LINES 24 #define STACK_SIZE 4000 static void DoReport(void); static void* DoTest(void* arg); GXColor Black = { 0, 0, 0, 0 }; GXColor Blue = { 0, 0, 192, 0 }; GXColor Red = { 255, 0, 0, 0 }; GXColor Green = { 0, 224, 0, 0 }; GXColor White = { 255, 255, 255, 0 }; GXColor SucceededGreen = { 0, 128, 0, 0 }; GXColor FailedRed = { 128, 0, 0, 0 }; static char ReportBuffer[4096]; static char PrintBuffer[4096]; static OSThread testThread; static u8 testThreadStack[STACK_SIZE] ATTRIBUTE_ALIGN(32); /*---------------------------------------------------------------------------* Application main loop *---------------------------------------------------------------------------*/ void main(void) { DEMOInit(NULL); if ( ! DEMOInitROMFont() ) { OSHalt("DEMOInitROMFont()"); } // Clear EFB GXSetCopyClear(Blue, GX_MAX_Z24); GXCopyDisp(DEMOGetCurrentBuffer(), GX_TRUE); (void)OSReport("NET Demo: Test digest functions\n"); // Launch the test thread if( ! OSCreateThread( &testThread, DoTest, NULL, (void*)((u32)testThreadStack + STACK_SIZE), STACK_SIZE, 20, 0 ) ) { OSHalt( "OSCrateThread()" ); } if ( OSResumeThread( &testThread ) < 0 ) { OSHalt( "OSResumeThread()" ); } while ( ! OSIsThreadTerminated(&testThread) ) { DEMOBeforeRender(); DoReport(); DEMODoneRender(); } { BOOL result; if( ! OSJoinThread( &testThread, (void**)&result ) ) { OSHalt( "OSJoinThread()" ); } if ( result ) { // succeeded OSReport("------ Test Succeeded ------\n"); GXSetCopyClear(SucceededGreen, GX_MAX_Z24); GXCopyDisp(DEMOGetCurrentBuffer(), GX_TRUE); } else { // failed OSReport("****** Test Failed ******\n"); GXSetCopyClear(FailedRed, GX_MAX_Z24); GXCopyDisp(DEMOGetCurrentBuffer(), GX_TRUE); } } while ( TRUE ) { DEMOBeforeRender(); DoReport(); DEMODoneRender(); } } /*---------------------------------------------------------------------------* Display Settings *---------------------------------------------------------------------------*/ static void DoReport(void) { GXRenderModeObj* rmp; rmp = DEMOGetRenderModeObj(); DEMOInitCaption(DM_FT_XLU, (s16) rmp->fbWidth, (s16) rmp->efbHeight); DEMOSetROMFontSize(16, -1); (void)DEMORFPuts(25, 25, 0, ReportBuffer); } // Define program-specific OSReport() function. void OSReport(const char* msg, ...) { BOOL enabled; va_list marker; u32 len; int c; char* p; char* q; va_start(marker, msg); (void)vsnprintf(PrintBuffer, sizeof(PrintBuffer)-1, msg, marker); va_end(marker); PrintBuffer[sizeof(PrintBuffer)-1] = 0; (void)printf("%s", PrintBuffer); enabled = OSDisableInterrupts(); (void)strncat(ReportBuffer, PrintBuffer, sizeof(ReportBuffer)-1); ReportBuffer[sizeof(ReportBuffer)-1] = 0; len = strlen(ReportBuffer); c = 0; q = ReportBuffer; for (p = ReportBuffer; p < ReportBuffer + len; ++p) { if (*p == '\n') { ++c; if (LINES <= c) { q = strchr(q, '\n'); } } } if (LINES <= c) { (void)memmove(ReportBuffer, q + 1, len - (q - ReportBuffer)); } (void)OSRestoreInterrupts(enabled); } /*---------------------------------------------------------------------------* Tests *---------------------------------------------------------------------------*/ #define PrintResultEq( a, b, f ) \ do { OSReport( ((a) == (b)) ? "[--OK--] " : "[**NG**] " ); (f) = (f) && ((a) == (b)); } while( FALSE ) #define PrintResultDigestEq( a, b, l, f ) \ do { OSReport( (memcmp((a), (b), (l)) == 0) ? "[--OK--] " : "[**NG**] " ); (f) = (f) && (memcmp((a), (b), (l)) == 0); } while( FALSE ) static void* DoTest(void* arg) { BOOL flag = TRUE; int i, j; (void)arg; // Test CRC-16 { char *a[] = { "123456789", }; u16 result_crc16[] = { 0xbb3d, }; for (i = 0; i < sizeof(a) / sizeof(char *); i++) { u16 result; result = NETCalcCRC16(a[i], strlen(a[i])); PrintResultEq(result, result_crc16[i], flag); OSReport("NETCalcCRC16(%s) = %04x\n", a[i], result); } } // Test CRC-32 { char *a[] = { "123456789", }; u32 result_crc32[] = { 0xcbf43926, }; for (i = 0; i < sizeof(a) / sizeof(char *); i++) { u32 result; result = NETCalcCRC32(a[i], strlen(a[i])); PrintResultEq(result, result_crc32[i], flag); OSReport("NETCalcCRC32(%s) = %04x\n", a[i], result); } } // Test MD5 // see: RFC1321 A.5 Test suite { char *a[] = { "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "1234567890", "FHXXKCVGGOFRILWGDLFQLZBLQSNYXWUCTXCBBVHUDWXLSFNIFTBNCGOMLXPQQFFJEOBXFBZNEDWMSKPPEWXONABBPRBHVDNQXPRHQGMLUHJVUPOXYUHDEXYMZBJCFNYZSKMPNLPYADWGXEKPYPKGNHQZMPBMSCYYYUPVPQZSYPPPIGKBQZUWOUCMVLFKORUIZWVWFVBEPZBXASLDAVBEHMJGYPYBQZAKHNLOFCPQVRRGKOVVRNERIFFJZIYAECMNHTRCUWGAKRZXPORLXLRXVRVVJIRTNDDIEFNGWFXBFDPPFOMPFWRGXQUBJYTNCCXKTUGRQYYGRFMDPKTWWFREVAUNHSAWUQQJOPIGRWHJDDOVHZHHGXDKVSDYRGXGCWMKQSENCIMJQOGNGAZFTDXYEVNRDWDKCKPJPIXZKCGJPEGFIJANNPJYHIRLPUBQAJSFMYLVGCPQZRUNKRRWEBLZYYOQUHGEMKGCXPKBWRXRANLRRHLGZSMONYDRIFPHOYSVYKZJRUSOVVUCULTSBOSGKYUVYCVHMIASIBFKGPRCKLVXZAGKCQUKMIHOIQJRBCJBKOYRNACLNHPSDBKUFBXAODNVHVTVVHHZEBAVRVMKBBEOYJSABXUDBJQEFLLYVBPWMSQQVLTGCASWRSHPIDOZRPZUCHYREWFCDZJOMMUGPHPTKWEIJIIGEHNFXKLWIHPKYORNBXESRYZMUNTJDGNQFGAFFRAWCKYRBZGNBZKOWAGWXZCOOEERHWPYIVXHDSZAVYFUBXNRJCVDDUJWWMYYXMCTXANZOPVULYAGPXZUQRBOAWEJKTUKIIDZVBVQRKINSAMSYKZVCINUUWVBVVUGGXLKMVBTFEESRQTNPOEYZRZVJBUEEXIQOXEWLMUUJQUWNOQTQQNJFBDNTCXMNJMJBIOCQZUCKCZFECNAXBXHLTCVURSEBLVAUIJKVGWZETIVGHWOFGRFPLIWQAUMTZOELCXBMVLHBRFZUIEIYWWUY", "YEDCGPVKFGWXYSDLTQOYAFHSJYABKIMQHJGDCKUSLRDQFJDGPVWBSBQ", "YEDCGPVKFGWXYSDLTQOYAFHSJYABKIMQHJGDCKUSLRDQFJDGPVWBSBQZ", "YEDCGPVKFGWXYSDLTQOYAFHSJYABKIMQHJGDCKUSLRDQFJDGPVWBSBQZZ", }; int c[] = { 1, 1, 1, 1, 1, 1, 8, 1, 2, 2, 2 }; char *result_md5[] = { "\xD4\x1D\x8C\xD9\x8F\x00\xB2\x04\xE9\x80\x09\x98\xEC\xF8\x42\x7E", "\x0C\xC1\x75\xB9\xC0\xF1\xB6\xA8\x31\xC3\x99\xE2\x69\x77\x26\x61", "\x90\x01\x50\x98\x3C\xD2\x4F\xB0\xD6\x96\x3F\x7D\x28\xE1\x7F\x72", "\xF9\x6B\x69\x7D\x7C\xB7\x93\x8D\x52\x5A\x2F\x31\xAA\xF1\x61\xD0", "\xC3\xFC\xD3\xD7\x61\x92\xE4\x00\x7D\xFB\x49\x6C\xCA\x67\xE1\x3B", "\xD1\x74\xAB\x98\xD2\x77\xD9\xF5\xA5\x61\x1C\x2C\x9F\x41\x9D\x9F", "\x57\xED\xF4\xA2\x2B\xE3\xC9\x55\xAC\x49\xDA\x2E\x21\x07\xB6\x7A", "\x72\xcc\x6a\x07\x35\x47\x48\x5d\xe7\x53\xcd\xa5\x90\xcb\x90\xbd", "\x5c\x07\x79\xcb\x86\xb1\x89\x2b\xe5\x3b\xdc\x72\x7b\x3b\x9b\x41", "\xc8\x69\xd4\x26\xf3\x4f\x78\x1b\xed\xaf\xdc\x9d\x29\xaf\x75\x7f", "\xa3\x1b\xd7\x8a\x72\x15\xa7\xc8\x59\x41\x51\xd5\x4b\xc8\x7d\x30", }; for (i = 0; i < sizeof(a) / sizeof(char *); i++) { u8 result[NET_MD5_DIGEST_SIZE]; if( c[i] == 1 ) { NETCalcMD5(result, a[i], strlen(a[i])); } else { NETMD5Context context; NETMD5Init(&context); for (j = 0; j < c[i]; j++) { NETMD5Update(&context, a[i], strlen(a[i])); } NETMD5GetDigest(&context, result); } PrintResultDigestEq(result, (u8 *)result_md5[i], sizeof(result), flag); OSReport("NET_MD5(%.70s) * %d\n", a[i], c[i]); } } #define USING_HMAC_CONTEXT // Perform HMAC-MD5 operation test. // See RFC2202. { char *d[] = { "Hi There", "what do ya want for nothing?", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", "Test With Truncation", // This test program does not use truncation. "Test Using Larger Than Block-Size Key - Hash Key First", "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", }; int dl[] = { 8, 28, 50, 50, 20, 54, 73 }; char *k[] = { "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Jefe", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", }; int kl[] = { 16, 4, 16, 25, 16, 80, 80 }; char *result_hmacmd5[] = { "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d", "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38", "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6", "\x69\x7e\xaf\x0a\xca\x3a\x3a\xea\x3a\x75\x16\x47\x46\xff\xaa\x79", "\x56\x46\x1e\xf2\x34\x2e\xdc\x00\xf9\xba\xb9\x95\x69\x0e\xfd\x4c", "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd", "\x6f\x63\x0f\xad\x67\xcd\xa0\xee\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e", }; for (i = 0; i < sizeof(d) / sizeof(char *); i++) { u8 result[NET_MD5_DIGEST_SIZE]; #ifndef USING_HMAC_CONTEXT NETCalcHMACMD5(result, d[i], dl[i], k[i], kl[i]); #else /* USING_HMAC_CONTEXT */ { NETHMACContext hmac[1]; NETHMACInit(hmac, NET_HASH_INTERFACE_MD5, k[i], (u32)kl[i]); NETHMACUpdate(hmac, d[i], (u32)dl[i]); NETHMACGetDigest(hmac, result); } #endif /* USING_HMAC_CONTEXT */ PrintResultDigestEq(result, (u8 *)result_hmacmd5[i], sizeof(result), flag); OSReport("NETCalcHMACMD5: Test Case %d\n", i + 1); } } // Perform SHA-1 operation test. // See RFC3174 7.3 Test Driver. { char *a[] = { "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "a", "0123456701234567012345670123456701234567012345670123456701234567", }; int c[] = { 1, 1, 1000000, 10 }; char *result_sha1[] = { "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D", "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1", "\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F", "\xDE\xA3\x56\xA2\xCD\xDD\x90\xC7\xA7\xEC\xED\xC5\xEB\xB5\x63\x93\x4F\x46\x04\x52", }; for (i = 0; i < sizeof(a) / sizeof(char *); i++) { u8 result[NET_SHA1_DIGEST_SIZE]; if( c[i] == 1 ) { NETCalcSHA1(result, a[i], strlen(a[i])); } else { NETSHA1Context context; NETSHA1Init(&context); for (j = 0; j < c[i]; j++) { NETSHA1Update(&context, a[i], strlen(a[i])); } NETSHA1GetDigest(&context, result); } PrintResultDigestEq(result, (u8 *)result_sha1[i], sizeof(result), flag); OSReport("NET_SHA1(%.70s) * %d\n", a[i], c[i]); } } // Perform HMAC-SHA-1 operation test. // See RFC2202. { char *d[] = { "Hi There", "what do ya want for nothing?", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", "Test With Truncation", // This test program does not use truncation. "Test Using Larger Than Block-Size Key - Hash Key First", "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", }; int dl[] = { 8, 28, 50, 50, 20, 54, 73 }; char *k[] = { "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Jefe", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", }; int kl[] = { 20, 4, 20, 25, 20, 80, 80 }; char *result_hmacsha1[] = { "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00", "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79", "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3", "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda", "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04", "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12", "\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91", }; for (i = 0; i < sizeof(d) / sizeof(char *); i++) { u8 result[NET_SHA1_DIGEST_SIZE]; #ifndef USING_HMAC_CONTEXT NETCalcHMACSHA1(result, d[i], dl[i], k[i], kl[i]); #else /* USING_HMAC_CONTEXT */ { NETHMACContext hmac[1]; NETHMACInit(hmac, NET_HASH_INTERFACE_SHA1, k[i], (u32)kl[i]); NETHMACUpdate(hmac, d[i], (u32)dl[i]); NETHMACGetDigest(hmac, result); } #endif /* USING_HMAC_CONTEXT */ PrintResultDigestEq(result, (u8 *)result_hmacsha1[i], sizeof(result), flag); OSReport("NETCalcHMACSHA1: Test Case %d\n", i + 1); } } return (void*)flag; }