mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Add extra scalarmult tests
This commit is contained in:
@@ -13,6 +13,10 @@ static const unsigned char max_canonical_p[32] = {
|
||||
0xe4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
|
||||
};
|
||||
static const unsigned char not_main_subgroup_p[32] = {
|
||||
0x95, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
|
||||
0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99
|
||||
};
|
||||
|
||||
static const unsigned char B[32] = {
|
||||
0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
@@ -69,9 +73,15 @@ main(void)
|
||||
if (crypto_scalarmult_ed25519(q, n, non_canonical_invalid_p) != -1) {
|
||||
printf("crypto_scalarmult_ed25519() didn't fail\n");
|
||||
}
|
||||
if (crypto_scalarmult_ed25519(q, n, not_main_subgroup_p) != -1) {
|
||||
printf("crypto_scalarmult_ed25519() didn't fail (non-subgroup)\n");
|
||||
}
|
||||
if (crypto_scalarmult_ed25519(q, n, max_canonical_p) != 0) {
|
||||
printf("crypto_scalarmult_ed25519() failed\n");
|
||||
}
|
||||
if (crypto_scalarmult_ed25519_noclamp(q, n, not_main_subgroup_p) != -1) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() didn't fail (non-subgroup)\n");
|
||||
}
|
||||
|
||||
n[0] = 9;
|
||||
if (crypto_scalarmult_ed25519(q, n, p) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user