@@ -685,12 +685,18 @@ void run_field_misc(void) {
685685 z = x ;
686686 secp256k1_fe_add (& z ,& y );
687687 secp256k1_fe_normalize (& z );
688- /* Test the conditional move. */
689- secp256k1_fe_cmov (& z , & x , 0 );
690- CHECK (secp256k1_fe_equal_var (& x , & z ) == 0 );
691- CHECK (secp256k1_fe_cmp_var (& x , & z ) != 0 );
692- secp256k1_fe_cmov (& y , & x , 1 );
693- CHECK (secp256k1_fe_equal_var (& x , & y ));
688+ /* Test storage conversion and conditional moves. */
689+ secp256k1_fe_storage_t xs , ys , zs ;
690+ secp256k1_fe_to_storage (& xs , & x );
691+ secp256k1_fe_to_storage (& ys , & y );
692+ secp256k1_fe_to_storage (& zs , & z );
693+ secp256k1_fe_storage_cmov (& zs , & xs , 0 );
694+ CHECK (memcmp (& xs , & zs , sizeof (xs )) != 0 );
695+ secp256k1_fe_storage_cmov (& ys , & xs , 1 );
696+ CHECK (memcmp (& xs , & ys , sizeof (xs )) == 0 );
697+ secp256k1_fe_from_storage (& x , & xs );
698+ secp256k1_fe_from_storage (& y , & ys );
699+ secp256k1_fe_from_storage (& z , & zs );
694700 /* Test that mul_int, mul, and add agree. */
695701 secp256k1_fe_add (& y , & x );
696702 secp256k1_fe_add (& y , & x );
0 commit comments