From 33d6908f9b8a9ebcb86d862fd8d94bdad8862ba0 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 24 Jul 2017 22:08:07 +0200 Subject: [PATCH] Test crypto_auth_hmacsha256_*() --- test/default/auth.c | 11 +++++++++++ test/default/auth.exp | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/test/default/auth.c b/test/default/auth.c index 8672c760..c0b805dc 100644 --- a/test/default/auth.c +++ b/test/default/auth.c @@ -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); diff --git a/test/default/auth.exp b/test/default/auth.exp index b18278ce..03b57d63 100644 --- a/test/default/auth.exp +++ b/test/default/auth.exp @@ -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