Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/bls_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ unsafe extern "C" {
pub unsafe fn blsInit(curve: usize, compiledTimeVar: usize) -> i32;

pub unsafe fn mclBnFr_isZero(secret_key: *const SecretKey) -> i32;
pub unsafe fn mclBnFr_isValid(secret_key: *const SecretKey) -> i32;
pub unsafe fn mclBn_getFrByteSize() -> usize;
pub unsafe fn mclBn_getFpByteSize() -> usize;
pub unsafe fn mclBnG2_setStr(x: *mut G2, buf: *const u8, buf_size: usize, io_mode: i32) -> i32;
Expand Down
10 changes: 10 additions & 0 deletions src/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,14 @@ impl SecretKey {

Ok(buf)
}

pub fn is_zero(&self) -> bool {
INIT.call_once(init_library);
unsafe { mclBnFr_isZero(self) == 1 }
}

pub fn is_valid(&self) -> bool {
INIT.call_once(init_library);
unsafe { mclBnFr_isValid(self) == 1 }
}
}