Skip to content

Commit

Permalink
use fe_impl_set_b32_limit so we know if a value is out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
xoloki committed Oct 10, 2024
1 parent b9f38b3 commit 1605d14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions p256k1/src/_rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pub use crate::bindings::{
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_add as secp256k1_fe_add,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_cmp_var as secp256k1_fe_cmp_var,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_get_b32 as secp256k1_fe_get_b32,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_set_b32_mod as secp256k1_fe_set_b32,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_set_b32_limit as secp256k1_fe_set_b32_limit,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_set_b32_mod as secp256k1_fe_set_b32_mod,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_set_b32_limit as secp256k1_fe_set_b32,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_inv as secp256k1_fe_inv,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_is_odd as secp256k1_fe_is_odd,
s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_mul as secp256k1_fe_mul,
Expand Down
2 changes: 1 addition & 1 deletion p256k1/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8396,7 +8396,7 @@ extern "C" {
pub fn s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_set_b32_limit(
r: *mut secp256k1_fe,
a: *const ::std::os::raw::c_uchar,
);
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn s642c885b6102725e25623738529895a95addc4f4_secp256k1_fe_impl_get_b32(
Expand Down
6 changes: 2 additions & 4 deletions p256k1/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,10 @@ impl TryFrom<&Compressed> for Point {

let mut x = secp256k1_fe { n: [0; 5] };

// XXX this is not ideal, since we should only load without rollover
secp256k1_fe_set_b32(&mut x, &c.data[1]);
/*let rx = secp256k1_fe_set_b32(&mut x, &c.data[1]);
let rx = secp256k1_fe_set_b32(&mut x, &c.data[1]);
if rx == 0 {
return Err(Error::Conversion(ConversionError::BadFieldElement));
}*/
}

let ry = secp256k1_ge_set_xo_var(
&mut y,
Expand Down

0 comments on commit 1605d14

Please sign in to comment.