@@ -928,8 +928,8 @@ void run_ge(void) {
928928
929929void run_ecmult_chain (void ) {
930930 /* random starting point A (on the curve) */
931- secp256k1_fe_t ax ; VERIFY_CHECK (secp256k1_fe_set_hex (& ax , "8b30bbe9ae2a990696b22f670709dff3727fd8bc04d3362c6c7bf458e2846004" , 64 ));
932- secp256k1_fe_t ay ; VERIFY_CHECK (secp256k1_fe_set_hex (& ay , "a357ae915c4a65281309edf20504740f0eb3343990216b4f81063cb65f2f7e0f" , 64 ));
931+ secp256k1_fe_t ax ; VERIFY_CHECK (secp256k1_fe_set_hex (& ax , "8b30bbe9ae2a990696b22f670709dff3727fd8bc04d3362c6c7bf458e2846004" ));
932+ secp256k1_fe_t ay ; VERIFY_CHECK (secp256k1_fe_set_hex (& ay , "a357ae915c4a65281309edf20504740f0eb3343990216b4f81063cb65f2f7e0f" ));
933933 secp256k1_gej_t a ; secp256k1_gej_set_xy (& a , & ax , & ay );
934934 /* two random initial factors xn and gn */
935935 static const unsigned char xni [32 ] = {
@@ -976,19 +976,18 @@ void run_ecmult_chain(void) {
976976
977977 /* verify */
978978 if (i == 19999 ) {
979- char res [132 ]; int resl = 132 ;
980- secp256k1_gej_get_hex (res , & resl , & x );
981- CHECK (strcmp (res , "(D6E96687F9B10D092A6F35439D86CEBEA4535D0D409F53586440BD74B933E830,B95CBCA2C77DA786539BE8FD53354D2D3B4F566AE658045407ED6015EE1B2A88)" ) == 0 );
979+ char res [131 ] ;
980+ secp256k1_gej_get_hex (res , & x );
981+ CHECK (memcmp (res , "(D6E96687F9B10D092A6F35439D86CEBEA4535D0D409F53586440BD74B933E830,B95CBCA2C77DA786539BE8FD53354D2D3B4F566AE658045407ED6015EE1B2A88)" , 131 ) == 0 );
982982 }
983983 }
984984 /* redo the computation, but directly with the resulting ae and ge coefficients: */
985985 secp256k1_gej_t x2 ; secp256k1_ecmult (& x2 , & a , & ae , & ge );
986- char res [132 ]; int resl = 132 ;
987- char res2 [132 ]; int resl2 = 132 ;
988- secp256k1_gej_get_hex (res , & resl , & x );
989- secp256k1_gej_get_hex (res2 , & resl2 , & x2 );
990- CHECK (strcmp (res , res2 ) == 0 );
991- CHECK (strlen (res ) == 131 );
986+ char res [131 ];
987+ char res2 [131 ];
988+ secp256k1_gej_get_hex (res , & x );
989+ secp256k1_gej_get_hex (res2 , & x2 );
990+ CHECK (memcmp (res , res2 , 131 ) == 0 );
992991}
993992
994993void test_point_times_order (const secp256k1_gej_t * point ) {
@@ -1015,7 +1014,7 @@ void test_point_times_order(const secp256k1_gej_t *point) {
10151014}
10161015
10171016void run_point_times_order (void ) {
1018- secp256k1_fe_t x ; VERIFY_CHECK (secp256k1_fe_set_hex (& x , "02" , 2 ));
1017+ secp256k1_fe_t x ; VERIFY_CHECK (secp256k1_fe_set_hex (& x , "0000000000000000000000000000000000000000000000000000000000000002" ));
10191018 for (int i = 0 ; i < 500 ; i ++ ) {
10201019 secp256k1_ge_t p ;
10211020 if (secp256k1_ge_set_xo_var (& p , & x , 1 )) {
@@ -1027,14 +1026,9 @@ void run_point_times_order(void) {
10271026 }
10281027 secp256k1_fe_sqr (& x , & x );
10291028 }
1030- char c [65 ];
1031- int cl = 1 ;
1032- c [1 ] = 123 ;
1033- secp256k1_fe_get_hex (c , & cl , & x ); /* Check that fe_get_hex handles a too short input. */
1034- CHECK (c [1 ] == 123 );
1035- cl = 65 ;
1036- secp256k1_fe_get_hex (c , & cl , & x );
1037- CHECK (strcmp (c , "7603CB59B0EF6C63FE6084792A0C378CDB3233A80F8A9A09A877DEAD31B38C45" ) == 0 );
1029+ char c [64 ];
1030+ secp256k1_fe_get_hex (c , & x );
1031+ CHECK (memcmp (c , "7603CB59B0EF6C63FE6084792A0C378CDB3233A80F8A9A09A877DEAD31B38C45" , 64 ) == 0 );
10381032}
10391033
10401034void test_wnaf (const secp256k1_scalar_t * number , int w ) {
0 commit comments