Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed safe blst_scalar_constructor #52

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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