From 81aa4ef4a3b2f751fc761f69bb6aa21f5a4f010c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 16 Sep 2014 10:19:32 -0700 Subject: [PATCH] Check crypto_onetimeauth() streaming interface --- test/default/onetimeauth.c | 13 +++++++++++++ test/default/onetimeauth.exp | 2 ++ 2 files changed, 15 insertions(+) diff --git a/test/default/onetimeauth.c b/test/default/onetimeauth.c index 4879256c..9a8b4f5d 100644 --- a/test/default/onetimeauth.c +++ b/test/default/onetimeauth.c @@ -24,6 +24,7 @@ unsigned char a[16]; int main(void) { + crypto_onetimeauth_state st; int i; crypto_onetimeauth(a, c, 131, rs); @@ -32,6 +33,18 @@ int main(void) if (i % 8 == 7) printf("\n"); } + + memset(a, 0, sizeof a); + crypto_onetimeauth_init(&st, rs); + crypto_onetimeauth_update(&st, c, 100); + crypto_onetimeauth_update(&st, c + 100, 31); + crypto_onetimeauth_final(&st, a); + for (i = 0; i < 16; ++i) { + printf(",0x%02x", (unsigned int)a[i]); + if (i % 8 == 7) + printf("\n"); + } + assert(crypto_onetimeauth_bytes() > 0U); assert(crypto_onetimeauth_keybytes() > 0U); assert(strcmp(crypto_onetimeauth_primitive(), "poly1305") == 0); diff --git a/test/default/onetimeauth.exp b/test/default/onetimeauth.exp index 6d914615..33973bd9 100644 --- a/test/default/onetimeauth.exp +++ b/test/default/onetimeauth.exp @@ -1,2 +1,4 @@ ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 +,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 +,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9