mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-14 10:45:47 +00:00
Address libc deprecations
This commit is contained in:
parent
6f9083b5ab
commit
c4e14ad0b1
@ -42,7 +42,7 @@ use rand_core::RngCore;
|
||||
use rand_os::OsRng;
|
||||
use std::io::BufReader;
|
||||
|
||||
use libc::{c_char, c_uchar, int64_t, size_t, uint32_t, uint64_t};
|
||||
use libc::{c_char, c_uchar, size_t};
|
||||
use std::ffi::CStr;
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
@ -404,7 +404,7 @@ pub extern "system" fn librustzcash_sapling_generate_r(result: *mut [c_uchar; 32
|
||||
fn priv_get_note(
|
||||
diversifier: *const [c_uchar; 11],
|
||||
pk_d: *const [c_uchar; 32],
|
||||
value: uint64_t,
|
||||
value: u64,
|
||||
r: *const [c_uchar; 32],
|
||||
) -> Result<sapling_crypto::primitives::Note<Bls12>, ()> {
|
||||
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
|
||||
@ -444,11 +444,11 @@ fn priv_get_note(
|
||||
pub extern "system" fn librustzcash_sapling_compute_nf(
|
||||
diversifier: *const [c_uchar; 11],
|
||||
pk_d: *const [c_uchar; 32],
|
||||
value: uint64_t,
|
||||
value: u64,
|
||||
r: *const [c_uchar; 32],
|
||||
ak: *const [c_uchar; 32],
|
||||
nk: *const [c_uchar; 32],
|
||||
position: uint64_t,
|
||||
position: u64,
|
||||
result: *mut [c_uchar; 32],
|
||||
) -> bool {
|
||||
let note = match priv_get_note(diversifier, pk_d, value, r) {
|
||||
@ -489,7 +489,7 @@ pub extern "system" fn librustzcash_sapling_compute_nf(
|
||||
pub extern "system" fn librustzcash_sapling_compute_cm(
|
||||
diversifier: *const [c_uchar; 11],
|
||||
pk_d: *const [c_uchar; 32],
|
||||
value: uint64_t,
|
||||
value: u64,
|
||||
r: *const [c_uchar; 32],
|
||||
result: *mut [c_uchar; 32],
|
||||
) -> bool {
|
||||
@ -562,8 +562,8 @@ pub extern "system" fn librustzcash_sapling_ka_derivepublic(
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "system" fn librustzcash_eh_isvalid(
|
||||
n: uint32_t,
|
||||
k: uint32_t,
|
||||
n: u32,
|
||||
k: u32,
|
||||
input: *const c_uchar,
|
||||
input_len: size_t,
|
||||
nonce: *const c_uchar,
|
||||
@ -700,7 +700,7 @@ pub extern "system" fn librustzcash_sapling_check_output(
|
||||
#[no_mangle]
|
||||
pub extern "system" fn librustzcash_sapling_final_check(
|
||||
ctx: *mut SaplingVerificationContext,
|
||||
value_balance: int64_t,
|
||||
value_balance: i64,
|
||||
binding_sig: *const [c_uchar; 64],
|
||||
sighash_value: *const [c_uchar; 32],
|
||||
) -> bool {
|
||||
@ -728,31 +728,31 @@ pub extern "system" fn librustzcash_sprout_prove(
|
||||
|
||||
// First input
|
||||
in_sk1: *const [c_uchar; 32],
|
||||
in_value1: uint64_t,
|
||||
in_value1: u64,
|
||||
in_rho1: *const [c_uchar; 32],
|
||||
in_r1: *const [c_uchar; 32],
|
||||
in_auth1: *const [c_uchar; 1 + 33 * SPROUT_TREE_DEPTH + 8],
|
||||
|
||||
// Second input
|
||||
in_sk2: *const [c_uchar; 32],
|
||||
in_value2: uint64_t,
|
||||
in_value2: u64,
|
||||
in_rho2: *const [c_uchar; 32],
|
||||
in_r2: *const [c_uchar; 32],
|
||||
in_auth2: *const [c_uchar; 1 + 33 * SPROUT_TREE_DEPTH + 8],
|
||||
|
||||
// First output
|
||||
out_pk1: *const [c_uchar; 32],
|
||||
out_value1: uint64_t,
|
||||
out_value1: u64,
|
||||
out_r1: *const [c_uchar; 32],
|
||||
|
||||
// Second output
|
||||
out_pk2: *const [c_uchar; 32],
|
||||
out_value2: uint64_t,
|
||||
out_value2: u64,
|
||||
out_r2: *const [c_uchar; 32],
|
||||
|
||||
// Public value
|
||||
vpub_old: uint64_t,
|
||||
vpub_new: uint64_t,
|
||||
vpub_old: u64,
|
||||
vpub_new: u64,
|
||||
) {
|
||||
let phi = unsafe { *phi };
|
||||
let rt = unsafe { *rt };
|
||||
@ -878,8 +878,8 @@ pub extern "system" fn librustzcash_sprout_verify(
|
||||
nf2: *const [c_uchar; 32],
|
||||
cm1: *const [c_uchar; 32],
|
||||
cm2: *const [c_uchar; 32],
|
||||
vpub_old: uint64_t,
|
||||
vpub_new: uint64_t,
|
||||
vpub_old: u64,
|
||||
vpub_new: u64,
|
||||
) -> bool {
|
||||
// Prepare the public input for the verifier
|
||||
let mut public_input = Vec::with_capacity((32 * 8) + (8 * 2));
|
||||
@ -923,7 +923,7 @@ pub extern "system" fn librustzcash_sapling_output_proof(
|
||||
diversifier: *const [c_uchar; 11],
|
||||
pk_d: *const [c_uchar; 32],
|
||||
rcm: *const [c_uchar; 32],
|
||||
value: uint64_t,
|
||||
value: u64,
|
||||
cv: *mut [c_uchar; 32],
|
||||
zkproof: *mut [c_uchar; GROTH_PROOF_SIZE],
|
||||
) -> bool {
|
||||
@ -1015,7 +1015,7 @@ pub extern "system" fn librustzcash_sapling_spend_sig(
|
||||
#[no_mangle]
|
||||
pub extern "system" fn librustzcash_sapling_binding_sig(
|
||||
ctx: *const SaplingProvingContext,
|
||||
value_balance: int64_t,
|
||||
value_balance: i64,
|
||||
sighash: *const [c_uchar; 32],
|
||||
result: *mut [c_uchar; 64],
|
||||
) -> bool {
|
||||
@ -1040,7 +1040,7 @@ pub extern "system" fn librustzcash_sapling_spend_proof(
|
||||
diversifier: *const [c_uchar; 11],
|
||||
rcm: *const [c_uchar; 32],
|
||||
ar: *const [c_uchar; 32],
|
||||
value: uint64_t,
|
||||
value: u64,
|
||||
anchor: *const [c_uchar; 32],
|
||||
witness: *const [c_uchar; 1 + 33 * SAPLING_TREE_DEPTH + 8],
|
||||
cv: *mut [c_uchar; 32],
|
||||
@ -1161,7 +1161,7 @@ pub extern "system" fn librustzcash_zip32_xsk_master(
|
||||
#[no_mangle]
|
||||
pub extern "system" fn librustzcash_zip32_xsk_derive(
|
||||
xsk_parent: *const [c_uchar; 169],
|
||||
i: uint32_t,
|
||||
i: u32,
|
||||
xsk_i: *mut [c_uchar; 169],
|
||||
) {
|
||||
let xsk_parent = zip32::ExtendedSpendingKey::read(&unsafe { *xsk_parent }[..])
|
||||
@ -1177,7 +1177,7 @@ pub extern "system" fn librustzcash_zip32_xsk_derive(
|
||||
#[no_mangle]
|
||||
pub extern "system" fn librustzcash_zip32_xfvk_derive(
|
||||
xfvk_parent: *const [c_uchar; 169],
|
||||
i: uint32_t,
|
||||
i: u32,
|
||||
xfvk_i: *mut [c_uchar; 169],
|
||||
) -> bool {
|
||||
let xfvk_parent = zip32::ExtendedFullViewingKey::read(&unsafe { *xfvk_parent }[..])
|
||||
|
Loading…
x
Reference in New Issue
Block a user