mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-09 12:29:27 +00:00
Move Rust definitions of C functions to their respective files
This commit is contained in:
parent
3533e66c7f
commit
0aeab04c70
2 changed files with 13 additions and 7 deletions
|
@ -2,7 +2,19 @@ use curve25519_dalek::{scalar::Scalar, edwards::EdwardsPoint};
|
|||
|
||||
use monero::{consensus::{Encodable, deserialize}, util::ringct::Bulletproof};
|
||||
|
||||
use crate::{Commitment, transaction::TransactionError, free, c_generate_bp, c_verify_bp};
|
||||
use crate::{Commitment, transaction::TransactionError};
|
||||
|
||||
#[link(name = "wrapper")]
|
||||
extern "C" {
|
||||
fn free(ptr: *const u8);
|
||||
fn c_generate_bp(len: u8, amounts: *const u64, masks: *const [u8; 32]) -> *const u8;
|
||||
fn c_verify_bp(
|
||||
serialized_len: usize,
|
||||
serialized: *const u8,
|
||||
commitments_len: u8,
|
||||
commitments: *const [u8; 32]
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
pub fn generate(outputs: &[Commitment]) -> Result<Bulletproof, TransactionError> {
|
||||
if outputs.len() > 16 {
|
||||
|
|
|
@ -24,13 +24,7 @@ pub mod transaction;
|
|||
|
||||
#[link(name = "wrapper")]
|
||||
extern "C" {
|
||||
pub(crate) fn free(ptr: *const u8);
|
||||
fn c_hash_to_point(point: *const u8);
|
||||
pub(crate) fn c_generate_bp(len: u8, amounts: *const u64, masks: *const [u8; 32]) -> *const u8;
|
||||
pub(crate) fn c_verify_bp(
|
||||
serialized_len: usize, serialized: *const u8,
|
||||
commitments_len: u8, commitments: *const [u8; 32]
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
|
|
Loading…
Reference in a new issue