2323#include "../include/secp256k1_preallocated.h"
2424#include "testrand_impl.h"
2525#include "checkmem.h"
26+ #include "testutil.h"
2627#include "util.h"
2728
2829#include "../contrib/lax_der_parsing.c"
@@ -2956,22 +2957,6 @@ static void run_scalar_tests(void) {
29562957
29572958/***** FIELD TESTS *****/
29582959
2959- static void random_fe (secp256k1_fe * x ) {
2960- unsigned char bin [32 ];
2961- do {
2962- secp256k1_testrand256 (bin );
2963- if (secp256k1_fe_set_b32_limit (x , bin )) {
2964- return ;
2965- }
2966- } while (1 );
2967- }
2968-
2969- static void random_fe_non_zero (secp256k1_fe * nz ) {
2970- do {
2971- random_fe (nz );
2972- } while (secp256k1_fe_is_zero (nz ));
2973- }
2974-
29752960static void random_fe_non_square (secp256k1_fe * ns ) {
29762961 secp256k1_fe r ;
29772962 random_fe_non_zero (ns );
@@ -3691,15 +3676,6 @@ static void run_inverse_tests(void)
36913676
36923677/***** GROUP TESTS *****/
36933678
3694- static void ge_equals_ge (const secp256k1_ge * a , const secp256k1_ge * b ) {
3695- CHECK (a -> infinity == b -> infinity );
3696- if (a -> infinity ) {
3697- return ;
3698- }
3699- CHECK (secp256k1_fe_equal (& a -> x , & b -> x ));
3700- CHECK (secp256k1_fe_equal (& a -> y , & b -> y ));
3701- }
3702-
37033679/* This compares jacobian points including their Z, not just their geometric meaning. */
37043680static int gej_xyz_equals_gej (const secp256k1_gej * a , const secp256k1_gej * b ) {
37053681 secp256k1_gej a2 ;
@@ -3722,23 +3698,6 @@ static int gej_xyz_equals_gej(const secp256k1_gej *a, const secp256k1_gej *b) {
37223698 return ret ;
37233699}
37243700
3725- static void ge_equals_gej (const secp256k1_ge * a , const secp256k1_gej * b ) {
3726- secp256k1_fe z2s ;
3727- secp256k1_fe u1 , u2 , s1 , s2 ;
3728- CHECK (a -> infinity == b -> infinity );
3729- if (a -> infinity ) {
3730- return ;
3731- }
3732- /* Check a.x * b.z^2 == b.x && a.y * b.z^3 == b.y, to avoid inverses. */
3733- secp256k1_fe_sqr (& z2s , & b -> z );
3734- secp256k1_fe_mul (& u1 , & a -> x , & z2s );
3735- u2 = b -> x ;
3736- secp256k1_fe_mul (& s1 , & a -> y , & z2s ); secp256k1_fe_mul (& s1 , & s1 , & b -> z );
3737- s2 = b -> y ;
3738- CHECK (secp256k1_fe_equal (& u1 , & u2 ));
3739- CHECK (secp256k1_fe_equal (& s1 , & s2 ));
3740- }
3741-
37423701static void test_ge (void ) {
37433702 int i , i1 ;
37443703 int runs = 6 ;
0 commit comments