Test box_easy with overlapping in/out.

This commit is contained in:
Frank Denis
2014-10-04 23:53:19 -07:00
parent e04f1b6854
commit c3b0de7393
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -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));
+2
View File
@@ -1,2 +1,4 @@
0
0
0
0