mirror of https://github.com/vacp2p/zerokit.git
FFI: Verify
This commit is contained in:
parent
a35392912f
commit
9507cf9fb8
|
@ -56,6 +56,22 @@ pub extern "C" fn prove(
|
|||
true
|
||||
}
|
||||
|
||||
// prove
|
||||
// verify
|
||||
// params?
|
||||
#[no_mangle]
|
||||
pub extern "C" fn verify(
|
||||
ctx: *const Multiplier,
|
||||
proof_buffer: *const Buffer,
|
||||
result_ptr: *mut u32,
|
||||
) -> bool {
|
||||
println!("multiplier ffi: verify");
|
||||
let mul = unsafe { &*ctx };
|
||||
let proof_data = <&[u8]>::from(unsafe { &*proof_buffer });
|
||||
if match mul.verify(proof_data) {
|
||||
Ok(verified) => verified,
|
||||
Err(_) => return false,
|
||||
} {
|
||||
unsafe { *result_ptr = 0 };
|
||||
} else {
|
||||
unsafe { *result_ptr = 1 };
|
||||
};
|
||||
true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue