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);