Skip to content

Commit

Permalink
image-rs: replace rand from openssl to ring
Browse files Browse the repository at this point in the history
openssl does not support cross compilation while ring supports, this
makes sense when we do cross compilation tests.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
  • Loading branch information
Xynnn007 committed Mar 13, 2024
1 parent 4cf22ae commit e7d6c05
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion image-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ttrpc-codegen = { workspace = true, optional = true }
cfg-if.workspace = true
filetime = "0.2"
nix = "0.26"
openssl.workspace = true
ring.workspace = true
rstest.workspace = true
serial_test = "2.0.0"
strum.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions image-rs/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ async fn channel_processing(
#[cfg(test)]
mod tests {
use super::*;
use openssl::rand::rand_bytes;
use ring::rand::SecureRandom;
use std::fs::File;
use std::io::BufReader;
use tar::{Builder, Header};

#[tokio::test]
async fn test_channel_processing() {
let mut data = [0; 100000];
rand_bytes(&mut data).unwrap();
ring::rand::SystemRandom::new().fill(&mut data[..]).unwrap();
let data_digest = sha2::Sha256::digest(data.as_slice());

let mut ar = Builder::new(Vec::new());
Expand Down Expand Up @@ -169,7 +169,7 @@ mod tests {
#[tokio::test]
async fn test_stream_processing() {
let mut data = [0; 100000];
rand_bytes(&mut data).unwrap();
ring::rand::SystemRandom::new().fill(&mut data[..]).unwrap();

let mut ar = Builder::new(Vec::new());
let mut header = Header::new_gnu();
Expand Down

0 comments on commit e7d6c05

Please sign in to comment.