From 5558885953a9f067a3dd74cb4e4c0637dc4f334e Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 21 Sep 2014 22:07:49 -0700 Subject: [PATCH] Add a test for crypto_sign() with overlapping buffers. --- test/default/sign.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/default/sign.c b/test/default/sign.c index 3bcde4d4..06c77d96 100644 --- a/test/default/sign.c +++ b/test/default/sign.c @@ -1115,6 +1115,18 @@ int main(void) printf("%u tests\n", i); i--; + + memcpy(sm, test_data[i].m, i); + if (crypto_sign(sm, &smlen, sm, i, skpk) != 0) { + printf("crypto_sign() with overlap failed\n"); + } + if (crypto_sign_open(sm, &mlen, sm, smlen, test_data[i].pk) != 0) { + printf("crypto_sign_open() with overlap failed\n"); + } + if (memcmp(test_data[i].m, sm, (size_t)mlen) != 0) { + printf("crypto_sign_open() with overlap failed (content)\n"); + } + for (j = 1U; j < 8U; j++) { sig[63] ^= (j << 5); if (crypto_sign_verify_detached(sig,