From d8b221c76d29310668b1810fed0c721eed9fdad2 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Mon, 17 Mar 2025 17:14:53 +0000 Subject: [PATCH] syn2mas: use ChaCha20 for all operations --- crates/syn2mas/src/migration.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/syn2mas/src/migration.rs b/crates/syn2mas/src/migration.rs index d56f1d487..cb75efd2f 100644 --- a/crates/syn2mas/src/migration.rs +++ b/crates/syn2mas/src/migration.rs @@ -340,7 +340,9 @@ async fn migrate_users( let (tx, mut rx) = tokio::sync::mpsc::channel::(10 * 1024 * 1024); - let mut rng = rand_chacha::ChaCha8Rng::from_rng(rng).expect("failed to seed rng"); + // create a new RNG seeded from the passed RNG so that we can move it into the + // spawned task + let mut rng = rand_chacha::ChaChaRng::from_rng(rng).expect("failed to seed rng"); let task = tokio::spawn( async move { let mut user_buffer = MasWriteBuffer::new(&mas, MasWriter::write_users); @@ -645,6 +647,8 @@ async fn migrate_devices( let (tx, mut rx) = tokio::sync::mpsc::channel(10 * 1024 * 1024); + // create a new RNG seeded from the passed RNG so that we can move it into the + // spawned task let mut rng = rand_chacha::ChaChaRng::from_rng(rng).expect("failed to seed rng"); let task = tokio::spawn( async move { @@ -784,6 +788,8 @@ async fn migrate_unrefreshable_access_tokens( let (tx, mut rx) = tokio::sync::mpsc::channel(10 * 1024 * 1024); let now = clock.now(); + // create a new RNG seeded from the passed RNG so that we can move it into the + // spawned task let mut rng = rand_chacha::ChaChaRng::from_rng(rng).expect("failed to seed rng"); let task = tokio::spawn( async move {