mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
udp: ConnectionValidator: add anyhow context to getrandom call
This commit is contained in:
parent
38962eba6b
commit
70cabfa89c
1 changed files with 2 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ use std::sync::atomic::AtomicUsize;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
use anyhow::Context;
|
||||||
use crossbeam_channel::{Sender, TrySendError};
|
use crossbeam_channel::{Sender, TrySendError};
|
||||||
use getrandom::getrandom;
|
use getrandom::getrandom;
|
||||||
|
|
||||||
|
|
@ -27,7 +28,7 @@ impl ConnectionValidator {
|
||||||
pub fn new(config: &Config) -> anyhow::Result<Self> {
|
pub fn new(config: &Config) -> anyhow::Result<Self> {
|
||||||
let mut key = [0; 32];
|
let mut key = [0; 32];
|
||||||
|
|
||||||
getrandom(&mut key)?;
|
getrandom(&mut key).with_context(|| "Couldn't get random bytes from system source")?;
|
||||||
|
|
||||||
let hmac = blake3::Hasher::new_keyed(&key);
|
let hmac = blake3::Hasher::new_keyed(&key);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue