Move Rust definitions of C functions to their respective files

This commit is contained in:
Luke Parker 2022-05-13 20:26:53 -04:00
parent 3533e66c7f
commit 0aeab04c70
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6
2 changed files with 13 additions and 7 deletions

View file

@ -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 {

View file

@ -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! {