group: add ge_to_bytes and ge_from_bytes

This commit is contained in:
Jonas Nick
2024-01-06 15:53:30 +00:00
committed by Tim Ruffing
parent de54a1eff7
commit 33db8edb27
4 changed files with 47 additions and 14 deletions

View File

@@ -4072,6 +4072,20 @@ static void test_add_neg_y_diff_x(void) {
CHECK(secp256k1_gej_eq_ge_var(&sumj, &res));
}
static void test_ge_bytes(void) {
int i;
for (i = 0; i < COUNT; i++) {
unsigned char buf[64];
secp256k1_ge p, q;
random_group_element_test(&p);
secp256k1_ge_to_bytes(buf, &p);
secp256k1_ge_from_bytes(&q, buf);
CHECK(secp256k1_ge_eq_var(&p, &q));
}
}
static void run_ge(void) {
int i;
for (i = 0; i < COUNT * 32; i++) {
@@ -4079,6 +4093,7 @@ static void run_ge(void) {
}
test_add_neg_y_diff_x();
test_intialized_inf();
test_ge_bytes();
}
static void test_gej_cmov(const secp256k1_gej *a, const secp256k1_gej *b) {