23
23
#include "../include/secp256k1_preallocated.h"
24
24
#include "testrand_impl.h"
25
25
#include "checkmem.h"
26
+ #include "testutil.h"
26
27
#include "util.h"
27
28
28
29
#include "../contrib/lax_der_parsing.c"
@@ -2956,22 +2957,6 @@ static void run_scalar_tests(void) {
2956
2957
2957
2958
/***** FIELD TESTS *****/
2958
2959
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
-
2975
2960
static void random_fe_non_square (secp256k1_fe * ns ) {
2976
2961
secp256k1_fe r ;
2977
2962
random_fe_non_zero (ns );
@@ -3691,15 +3676,6 @@ static void run_inverse_tests(void)
3691
3676
3692
3677
/***** GROUP TESTS *****/
3693
3678
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
-
3703
3679
/* This compares jacobian points including their Z, not just their geometric meaning. */
3704
3680
static int gej_xyz_equals_gej (const secp256k1_gej * a , const secp256k1_gej * b ) {
3705
3681
secp256k1_gej a2 ;
@@ -3722,23 +3698,6 @@ static int gej_xyz_equals_gej(const secp256k1_gej *a, const secp256k1_gej *b) {
3722
3698
return ret ;
3723
3699
}
3724
3700
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
-
3742
3701
static void test_ge (void ) {
3743
3702
int i , i1 ;
3744
3703
int runs = 6 ;
0 commit comments