Test crypto_box_beforenm() with a small order pk

This commit is contained in:
Frank Denis
2015-12-25 02:00:01 +01:00
parent cdd45e413a
commit 2f1cec7352
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ static const unsigned char bobpk[32]
0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78,
0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f };
static const unsigned char small_order_p[crypto_scalarmult_BYTES]
static const unsigned char small_order_p[crypto_box_PUBLICKEYBYTES]
= { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 };
+10
View File
@@ -2,6 +2,11 @@
#define TEST_NAME "box_easy2"
#include "cmptest.h"
static const unsigned char small_order_p[crypto_box_PUBLICKEYBYTES]
= { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 };
int main(void)
{
unsigned char *alicepk;
@@ -68,6 +73,11 @@ int main(void)
printf("crypto_box_open_easy() failed\n");
}
ret = crypto_box_beforenm(k1, small_order_p, bobsk);
assert(ret == -1);
ret = crypto_box_beforenm(k2, small_order_p, alicesk);
assert(ret == -1);
ret = crypto_box_beforenm(k1, alicepk, bobsk);
assert(ret == 0);
ret = crypto_box_beforenm(k2, bobpk, alicesk);