Skip to content

Commit

Permalink
fix: fip FLAG_BITS
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnevadoc committed Mar 6, 2024
1 parent 45e3366 commit 66ba485
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/derive/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ macro_rules! new_curve_impl {
#[allow(non_upper_case_globals)]
const [< $name _FLAG_BITS >]: u8 =
if $spare_bits == 1 {
0b0111_1111
0b1000_0000
} else if $spare_bits == 2 {
0b0011_1111
0b1100_0000
} else {
//$spare_bits == 0
0b0000_0000
0b1111_1111
};

impl group::GroupEncoding for $name_affine {
Expand Down Expand Up @@ -175,7 +175,7 @@ macro_rules! new_curve_impl {
};

// Clear flag bits
tmp[[< $name _FLAG_BYTE_INDEX>]] &= [< $name _FLAG_BITS >];
tmp[[< $name _FLAG_BYTE_INDEX>]] &= ![< $name _FLAG_BITS >];

// Get x-coordinate
let mut xbytes = [0u8; $base::size()];
Expand Down Expand Up @@ -329,7 +329,7 @@ macro_rules! new_curve_impl {
let identity_flag = Choice::from( ( ( bytes[ flag_idx ] & IS_IDENTITY_MASK) >> IS_IDENTITY_SHIFT) );

// Clear flags.
bytes[flag_idx] &= [< $name _FLAG_BITS >];
bytes[flag_idx] &= ![< $name _FLAG_BITS >];
identity_flag
} else {
// With 0 and 1 spare bit there is no identity flag, so we just rely
Expand Down

0 comments on commit 66ba485

Please sign in to comment.