summaryrefslogtreecommitdiff
path: root/tests/hmac.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2005-08-19 07:58:27 +0000
committerWerner Koch <wk@gnupg.org>2005-08-19 07:58:27 +0000
commit5c7098e4c8f6607087287c112cf2b02e10aeb413 (patch)
tree86c89175c92d07f9796e8f61e331695e744bc526 /tests/hmac.c
parent02e5cb6bd1e009425a75be3cb98c49b29740582f (diff)
downloadlibgcrypt-5c7098e4c8f6607087287c112cf2b02e10aeb413.tar.gz
added remaining 2 tests.
Diffstat (limited to 'tests/hmac.c')
-rw-r--r--tests/hmac.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/hmac.c b/tests/hmac.c
index a3cbe5d7..5e71f2c9 100644
--- a/tests/hmac.c
+++ b/tests/hmac.c
@@ -111,23 +111,41 @@ check_one_mac (int algo,
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