From c3b0de73937df32a63660ec32fbc7f72e1a2ae8e Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 4 Oct 2014 23:53:19 -0700 Subject: [PATCH] Test box_easy with overlapping in/out. --- test/default/box_easy2.c | 10 ++++++++++ test/default/box_easy2.exp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/test/default/box_easy2.c b/test/default/box_easy2.c index 5e22677f..9feea81c 100644 --- a/test/default/box_easy2.c +++ b/test/default/box_easy2.c @@ -36,6 +36,16 @@ int main(void) return 1; } } + + memcpy(c, m, mlen); + crypto_box_easy(c, c, mlen, nonce, bobpk, alicesk); + printf("%d\n", memcmp(m, c, mlen) == 0); + printf("%d\n", memcmp(m, c + crypto_box_MACBYTES, mlen) == 0); + if (crypto_box_open_easy(c, c, mlen + crypto_box_MACBYTES, nonce, alicepk, + bobsk) != 0) { + printf("crypto_box_open_easy() failed\n"); + } + crypto_box_detached(c, mac, m, mlen, nonce, bobsk, alicepk); crypto_box_open_detached(m2, c, mac, mlen, nonce, alicepk, bobsk); printf("%d\n", memcmp(m, m2, mlen)); diff --git a/test/default/box_easy2.exp b/test/default/box_easy2.exp index aa47d0d4..44e0be8e 100644 --- a/test/default/box_easy2.exp +++ b/test/default/box_easy2.exp @@ -1,2 +1,4 @@ 0 0 +0 +0