Skip to content

Commit

Permalink
supranational#13 Exposed safe blst_scalar_constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmishra2005 committed Jan 21, 2021
1 parent 21ff3ef commit cb9d3e4
Showing 1 changed file with 39 additions and 17 deletions.
56 changes: 39 additions & 17 deletions bindings/rust/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,33 +182,58 @@ fn bindgen_test_layout_blst_fp12() {
)
);
}
extern "C" {
pub fn blst_scalar_from_uint32(out: *mut blst_scalar, a: *const u32);
mod sys{
use super::{blst_scalar, blst_fr, byte};
extern "C" {
pub fn blst_scalar_from_uint32(out: *mut blst_scalar, a: *const u32);
}
extern "C" {
pub fn blst_scalar_from_uint64(out: *mut blst_scalar, a: *const u64);
}
extern "C" {
pub fn blst_scalar_from_bendian(out: *mut blst_scalar, a: *const byte);
}
extern "C" {
pub fn blst_scalar_from_lendian(out: *mut blst_scalar, a: *const byte);
}
extern "C" {
pub fn blst_scalar_fr_check(a: *const blst_scalar) -> bool;
}
extern "C" {
pub fn blst_scalar_from_fr(ret: *mut blst_scalar, a: *const blst_fr);
}
}
pub fn blst_scalar_from_uint32(out: *mut blst_scalar, a: *const u32) {
unsafe { sys::blst_scalar_from_uint32(out, a) }
}
pub fn blst_scalar_from_uint64(out: *mut blst_scalar, a: *const u64) {
unsafe { sys::blst_scalar_from_uint64(out, a) }
}
pub fn blst_scalar_from_bendian(out: *mut blst_scalar, a: *const byte) {
unsafe { sys::blst_scalar_from_bendian(out, a) }
}
pub fn blst_scalar_from_lendian(out: *mut blst_scalar, a: *const byte) {
unsafe { sys::blst_scalar_from_lendian(out, a) }
}
pub fn blst_scalar_fr_check(a: *const blst_scalar) -> bool {
unsafe { sys::blst_scalar_fr_check(a) }
}
pub fn blst_scalar_from_fr(ret: *mut blst_scalar, a: *const blst_fr) {
unsafe { sys::blst_scalar_from_fr(ret, a)}
}

extern "C" {
pub fn blst_uint32_from_scalar(out: *mut u32, a: *const blst_scalar);
}
extern "C" {
pub fn blst_scalar_from_uint64(out: *mut blst_scalar, a: *const u64);
}
extern "C" {
pub fn blst_uint64_from_scalar(out: *mut u64, a: *const blst_scalar);
}
extern "C" {
pub fn blst_scalar_from_bendian(out: *mut blst_scalar, a: *const byte);
}
extern "C" {
pub fn blst_bendian_from_scalar(out: *mut byte, a: *const blst_scalar);
}
extern "C" {
pub fn blst_scalar_from_lendian(out: *mut blst_scalar, a: *const byte);
}
extern "C" {
pub fn blst_lendian_from_scalar(out: *mut byte, a: *const blst_scalar);
}
extern "C" {
pub fn blst_scalar_fr_check(a: *const blst_scalar) -> bool;
}
extern "C" {
pub fn blst_sk_check(a: *const blst_scalar) -> bool;
}
Expand Down Expand Up @@ -248,9 +273,6 @@ extern "C" {
extern "C" {
pub fn blst_fr_from_scalar(ret: *mut blst_fr, a: *const blst_scalar);
}
extern "C" {
pub fn blst_scalar_from_fr(ret: *mut blst_scalar, a: *const blst_fr);
}
extern "C" {
pub fn blst_fp_add(ret: *mut blst_fp, a: *const blst_fp, b: *const blst_fp);
}
Expand Down

0 comments on commit cb9d3e4

Please sign in to comment.