|
|
|
@ -3078,28 +3078,22 @@ void run_eckey_edge_case_test(void) {
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0);
|
|
|
|
|
CHECK(ecount == 1);
|
|
|
|
|
memset(&pubkey, 255, sizeof(secp256k1_pubkey));
|
|
|
|
|
VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, -1) == 0);
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0);
|
|
|
|
|
CHECK(ecount == 2);
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, NULL, pubkeys, 1) == 0);
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0);
|
|
|
|
|
CHECK(ecount == 3);
|
|
|
|
|
CHECK(ecount == 2);
|
|
|
|
|
memset(&pubkey, 255, sizeof(secp256k1_pubkey));
|
|
|
|
|
VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, NULL, 1) == 0);
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0);
|
|
|
|
|
CHECK(ecount == 4);
|
|
|
|
|
CHECK(ecount == 3);
|
|
|
|
|
pubkeys[0] = &pubkey_negone;
|
|
|
|
|
memset(&pubkey, 255, sizeof(secp256k1_pubkey));
|
|
|
|
|
VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 1) == 1);
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0);
|
|
|
|
|
CHECK(ecount == 4);
|
|
|
|
|
CHECK(ecount == 3);
|
|
|
|
|
len = 33;
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp, &len, &pubkey, SECP256K1_EC_COMPRESSED) == 1);
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp2, &len, &pubkey_negone, SECP256K1_EC_COMPRESSED) == 1);
|
|
|
|
@ -3112,7 +3106,7 @@ void run_eckey_edge_case_test(void) {
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 2) == 0);
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0);
|
|
|
|
|
CHECK(ecount == 4);
|
|
|
|
|
CHECK(ecount == 3);
|
|
|
|
|
/* Passes through infinity but comes out one. */
|
|
|
|
|
pubkeys[2] = &pubkey_one;
|
|
|
|
|
memset(&pubkey, 255, sizeof(secp256k1_pubkey));
|
|
|
|
@ -3120,7 +3114,7 @@ void run_eckey_edge_case_test(void) {
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 3) == 1);
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0);
|
|
|
|
|
CHECK(ecount == 4);
|
|
|
|
|
CHECK(ecount == 3);
|
|
|
|
|
len = 33;
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp, &len, &pubkey, SECP256K1_EC_COMPRESSED) == 1);
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp2, &len, &pubkey_one, SECP256K1_EC_COMPRESSED) == 1);
|
|
|
|
@ -3132,7 +3126,7 @@ void run_eckey_edge_case_test(void) {
|
|
|
|
|
CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 2) == 1);
|
|
|
|
|
VG_CHECK(&pubkey, sizeof(secp256k1_pubkey));
|
|
|
|
|
CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0);
|
|
|
|
|
CHECK(ecount == 4);
|
|
|
|
|
CHECK(ecount == 3);
|
|
|
|
|
secp256k1_context_set_illegal_callback(ctx, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|