[svn] gcry - r1101 - trunk/tests
svn author wk
cvs at cvs.gnupg.org
Fri Aug 19 09:58:27 CEST 2005
Author: wk
Date: 2005-08-19 09:58:27 +0200 (Fri, 19 Aug 2005)
New Revision: 1101
Modified:
trunk/tests/ChangeLog
trunk/tests/hmac.c
Log:
added remaining 2 tests.
Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog 2005-08-18 16:05:22 UTC (rev 1100)
+++ trunk/tests/ChangeLog 2005-08-19 07:58:27 UTC (rev 1101)
@@ -1,3 +1,7 @@
+2005-08-19 Werner Koch <wk at g10code.com>
+
+ * hmac.c (main): Added all FIPS tests.
+
2005-08-18 Werner Koch <wk at g10code.com>
* hmac.c: New.
Modified: trunk/tests/hmac.c
===================================================================
--- trunk/tests/hmac.c 2005-08-18 16:05:22 UTC (rev 1100)
+++ trunk/tests/hmac.c 2005-08-19 07:58:27 UTC (rev 1101)
@@ -111,23 +111,41 @@
static void
check_hmac (void)
{
- unsigned char key[64];
+ unsigned char key[128];
int i, j;
- /* FIPS 198a, A.1 */
+ if (verbose)
+ fprintf (stderr, "checking FIPS-198a, A.1\n");
for (i=0; i < 64; i++)
key[i] = i;
check_one_mac (GCRY_MD_SHA1, key, 64, "Sample #1", 9,
"\x4f\x4c\xa3\xd5\xd6\x8b\xa7\xcc\x0a\x12"
"\x08\xc9\xc6\x1e\x9c\x5d\xa0\x40\x3c\x0a");
- /* FIPS 198a, A.2 */
+ if (verbose)
+ fprintf (stderr, "checking FIPS-198a, A.2\n");
for (i=0, j=0x30; i < 20; i++)
key[i] = j++;
check_one_mac (GCRY_MD_SHA1, key, 20, "Sample #2", 9,
"\x09\x22\xd3\x40\x5f\xaa\x3d\x19\x4f\x82"
"\xa4\x58\x30\x73\x7d\x5c\xc6\xc7\x5d\x24");
+ if (verbose)
+ fprintf (stderr, "checking FIPS-198a, A.3\n");
+ for (i=0, j=0x50; i < 100; i++)
+ key[i] = j++;
+ check_one_mac (GCRY_MD_SHA1, key, 100, "Sample #3", 9,
+ "\xbc\xf4\x1e\xab\x8b\xb2\xd8\x02\xf3\xd0"
+ "\x5c\xaf\x7c\xb0\x92\xec\xf8\xd1\xa3\xaa");
+
+ if (verbose)
+ fprintf (stderr, "checking FIPS-198a, A.4\n");
+ for (i=0, j=0x70; i < 49; i++)
+ key[i] = j++;
+ check_one_mac (GCRY_MD_SHA1, key, 49, "Sample #4", 9,
+ "\x9e\xa8\x86\xef\xe2\x68\xdb\xec\xce\x42"
+ "\x0c\x75\x24\xdf\x32\xe0\x75\x1a\x2a\x26");
+
}
int
More information about the Gnupg-commits
mailing list