@@ -4016,13 +4016,33 @@ static void test_add_neg_y_diff_x(void) {
40164016 CHECK (secp256k1_gej_eq_ge_var (& sumj , & res ));
40174017}
40184018
4019+ static void test_ge_bytes (void ) {
4020+ unsigned char buf [64 ];
4021+ unsigned char expected_buf [64 ] = {
4022+ 0x98 , 0x17 , 0xF8 , 0x16 , 0x5B , 0x81 , 0xF2 , 0x59 ,
4023+ 0xD9 , 0x28 , 0xCE , 0x2D , 0xDB , 0xFC , 0x9B , 0x02 ,
4024+ 0x07 , 0x0B , 0x87 , 0xCE , 0x95 , 0x62 , 0xA0 , 0x55 ,
4025+ 0xAC , 0xBB , 0xDC , 0xF9 , 0x7E , 0x66 , 0xBE , 0x79 ,
4026+ 0xB8 , 0xD4 , 0x10 , 0xFB , 0x8F , 0xD0 , 0x47 , 0x9C ,
4027+ 0x19 , 0x54 , 0x85 , 0xA6 , 0x48 , 0xB4 , 0x17 , 0xFD ,
4028+ 0xA8 , 0x08 , 0x11 , 0x0E , 0xFC , 0xFB , 0xA4 , 0x5D ,
4029+ 0x65 , 0xC4 , 0xA3 , 0x26 , 0x77 , 0xDA , 0x3A , 0x48 ,
4030+ };
4031+ secp256k1_ge p , g = secp256k1_ge_const_g ;
4032+ secp256k1_ge_to_bytes (buf , & g );
4033+ CHECK (memcmp (buf , expected_buf , sizeof (buf )) == 0 );
4034+ secp256k1_ge_from_bytes (& p , buf );
4035+ CHECK (secp256k1_ge_eq_var (& p , & g ));
4036+ }
4037+
40194038static void run_ge (void ) {
40204039 int i ;
40214040 for (i = 0 ; i < COUNT * 32 ; i ++ ) {
40224041 test_ge ();
40234042 }
40244043 test_add_neg_y_diff_x ();
40254044 test_intialized_inf ();
4045+ test_ge_bytes ();
40264046}
40274047
40284048static void test_gej_cmov (const secp256k1_gej * a , const secp256k1_gej * b ) {
0 commit comments