Check that crypto_box[_beforenm] fails with a small order pk
This commit is contained in:
parent
60d05339fd
commit
b80d037b4d
@ -12,6 +12,11 @@ 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]
|
||||
= { 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 };
|
||||
|
||||
static const unsigned char nonce[24]
|
||||
= { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
|
||||
0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6,
|
||||
@ -50,8 +55,12 @@ int main(void)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
ret = crypto_box(c, m, 163, nonce, small_order_p, alicesk);
|
||||
assert(ret == -1);
|
||||
|
||||
memset(c, 0, sizeof c);
|
||||
|
||||
ret = crypto_box_beforenm(k, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
crypto_box_afternm(c, m, 163, nonce, k);
|
||||
@ -61,6 +70,9 @@ int main(void)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
ret = crypto_box_beforenm(k, small_order_p, alicesk);
|
||||
assert(ret == -1);
|
||||
|
||||
assert(crypto_box_seedbytes() > 0U);
|
||||
assert(crypto_box_publickeybytes() > 0U);
|
||||
|
Loading…
Reference in New Issue
Block a user