Add a test for crypto_sign() with overlapping buffers.

This commit is contained in:
Frank Denis 2014-09-21 22:07:49 -07:00
parent ad5a165f94
commit 5558885953

View File

@ -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,