mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-10 16:11:30 +01:00
chore: handle deprecations in winterfell 0.8.3 release
This commit is contained in:
committed by
Paul Schoenfelder
parent
4bc4bea0db
commit
999a64fca6
@@ -1,4 +1,4 @@
|
||||
use libc::c_int;
|
||||
use core::ffi::c_int;
|
||||
|
||||
// C IMPLEMENTATION INTERFACE
|
||||
// ================================================================================================
|
||||
@@ -77,8 +77,11 @@ extern "C" {
|
||||
#[cfg(test)]
|
||||
pub fn rpo128_absorb(
|
||||
sc: *mut Rpo128Context,
|
||||
data: *const ::std::os::raw::c_void,
|
||||
len: libc::size_t,
|
||||
data: *const core::ffi::c_void,
|
||||
// TODO: When #![feature(c_size_t)] stabilizes, switch this to `core::ffi::size_t` to be
|
||||
// more accurate. Currently, however, all Rust targets as of this writing are such that
|
||||
// `core::ffi::size_t` and `usize` are the same size.
|
||||
len: usize,
|
||||
);
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -96,6 +99,7 @@ pub struct Rpo128Context {
|
||||
|
||||
#[cfg(all(test, feature = "std"))]
|
||||
mod tests {
|
||||
use alloc::vec::Vec;
|
||||
use rand_utils::{rand_array, rand_value, rand_vector};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#[cfg(feature = "std")]
|
||||
use super::{ffi, NonceBytes, NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN};
|
||||
use super::{
|
||||
ByteReader, ByteWriter, Deserializable, DeserializationError, FalconError, Polynomial,
|
||||
PublicKeyBytes, Rpo256, SecretKeyBytes, Serializable, Signature, Word,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
use {
|
||||
super::{ffi, NonceBytes, NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN},
|
||||
alloc::vec::Vec,
|
||||
};
|
||||
|
||||
// PUBLIC KEY
|
||||
// ================================================================================================
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use alloc::vec::Vec;
|
||||
use core::ops::{Add, Mul, Sub};
|
||||
|
||||
use super::{FalconError, Felt, LOG_N, MODULUS, MODULUS_MINUS_1_OVER_TWO, N, PK_LEN};
|
||||
use crate::utils::collections::*;
|
||||
|
||||
// FALCON POLYNOMIAL
|
||||
// ================================================================================================
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use alloc::string::ToString;
|
||||
use core::cell::OnceCell;
|
||||
|
||||
use super::{
|
||||
@@ -5,7 +6,6 @@ use super::{
|
||||
Polynomial, PublicKeyBytes, Rpo256, Serializable, SignatureBytes, Word, MODULUS, N,
|
||||
SIG_L2_BOUND, ZERO,
|
||||
};
|
||||
use crate::utils::string::*;
|
||||
|
||||
// FALCON SIGNATURE
|
||||
// ================================================================================================
|
||||
@@ -196,7 +196,7 @@ fn decode_nonce(nonce: &NonceBytes) -> NonceElements {
|
||||
|
||||
#[cfg(all(test, feature = "std"))]
|
||||
mod tests {
|
||||
use libc::c_void;
|
||||
use core::ffi::c_void;
|
||||
use rand_utils::rand_vector;
|
||||
|
||||
use super::{
|
||||
@@ -236,7 +236,10 @@ mod tests {
|
||||
fn test_hash_to_point() {
|
||||
// Create a random message and transform it into a u8 vector
|
||||
let msg_felts: Word = rand_vector::<Felt>(4).try_into().unwrap();
|
||||
let msg_bytes = msg_felts.iter().flat_map(|e| e.as_int().to_le_bytes()).collect::<Vec<_>>();
|
||||
let msg_bytes = msg_felts
|
||||
.iter()
|
||||
.flat_map(|e| e.as_int().to_le_bytes())
|
||||
.collect::<alloc::vec::Vec<_>>();
|
||||
|
||||
// Create a nonce i.e. a [u8; 40] array and pack into a [Felt; 8] array.
|
||||
let nonce: [u8; 40] = rand_vector::<u8>(40).try_into().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user