@@ -653,8 +653,8 @@ namespace nil {
653
653
std::is_same<bool , typename std::iterator_traits<TIter>::value_type>::value,
654
654
nil::marshalling::status_type>::type
655
655
process (const group_value_type &point, TIter &iter) {
656
- auto X_affine =
657
- static_cast < typename group_value_type::field_type::integral_type>( point.to_affine ().X .data );
656
+ auto X_affine = static_cast < typename group_value_type::field_type::integral_type>(
657
+ point.to_affine ().X .data );
658
658
for (std::size_t i = 0 ; i < params_type::bit_length (); ++i) {
659
659
*iter++ = bit_test (X_affine, 0 );
660
660
X_affine >>= 1 ;
@@ -708,7 +708,7 @@ namespace nil {
708
708
integral_type x = read_data<sizeof_field_element, integral_type, endianness>(iter);
709
709
710
710
g1_field_value_type x_mod (x);
711
- g1_field_value_type y2_mod = x_mod.pow (3 ) + g1_field_value_type (4 );
711
+ g1_field_value_type y2_mod = x_mod.pow (3u ) + g1_field_value_type (4u );
712
712
BOOST_ASSERT (y2_mod.is_square ());
713
713
g1_field_value_type y_mod = y2_mod.sqrt ();
714
714
bool Y_bit = detail::sign_gf_p<g1_field_type>(y_mod);
@@ -775,7 +775,7 @@ namespace nil {
775
775
integral_type x_0 = read_data<sizeof_field_element, integral_type, endianness>(read_iter);
776
776
777
777
g2_field_value_type x_mod (x_0, x_1);
778
- g2_field_value_type y2_mod = x_mod.pow (3 ) + g2_field_value_type (4 , 4 );
778
+ g2_field_value_type y2_mod = x_mod.pow (3u ) + g2_field_value_type (4u , 4u );
779
779
BOOST_ASSERT (y2_mod.is_square ());
780
780
g2_field_value_type y_mod = y2_mod.sqrt ();
781
781
bool Y_bit = detail::sign_gf_p<g2_field_type>(y_mod);
@@ -1249,7 +1249,8 @@ namespace nil {
1249
1249
u = field_type::value_type::zero ();
1250
1250
} else {
1251
1251
u = fraction.sqrt ();
1252
- if (u == field_type::value_type (field_type::modulus - 1 )) {
1252
+ // Sqrt now returns 0 on error. We will change this when proper error handling is implemented.
1253
+ if (u == field_type::value_type::zero ()) {
1253
1254
return nil::marshalling::status_type::invalid_msg_data;
1254
1255
}
1255
1256
}
0 commit comments