Test crypto_auth_hmacsha256_*()

This commit is contained in:
Frank Denis
2017-07-24 22:08:07 +02:00
parent f92c82537b
commit 33d6908f9b
2 changed files with 19 additions and 0 deletions
+11
View File
@@ -52,6 +52,17 @@ main(void)
printf("\n");
}
memset(a2, 0, sizeof a2);
crypto_auth_hmacsha256_init(&st, key2, sizeof key2);
crypto_auth_hmacsha256_update(&st, c, 1U);
crypto_auth_hmacsha256_update(&st, c, sizeof c - 2U);
crypto_auth_hmacsha256_final(&st, a2);
for (i = 0; i < sizeof a2; ++i) {
printf(",0x%02x", (unsigned int) a2[i]);
if (i % 8 == 7)
printf("\n");
}
assert(crypto_auth_bytes() > 0U);
assert(crypto_auth_keybytes() > 0U);
assert(strcmp(crypto_auth_primitive(), "hmacsha512256") == 0);
+8
View File
@@ -20,3 +20,11 @@
,0x31,0x8a,0x9a,0x0b,0x3b,0x78,0x60,0xa4
,0x31,0x6f,0x72,0x9b,0x8d,0x30,0x0f,0x15
,0x9b,0x2f,0x60,0x93,0xa8,0x60,0xc1,0xed
,0x62,0x27,0xe4,0xce,0x7c,0x7f,0xe7,0xa4
,0xba,0x9e,0x2a,0xc3,0x42,0xc3,0x5d,0x24
,0x03,0x3e,0x38,0x8c,0x9b,0xdc,0x29,0x9b
,0x4a,0x50,0x50,0xf6,0x71,0x70,0xf4,0x83
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00