Skip to main content

rsa/
dummy_rng.rs

1use core::convert::Infallible;
2use rand_core::{TryCryptoRng, TryRng};
3
4/// This is a dummy RNG for cases when we need a concrete RNG type
5/// which does not get used.
6#[derive(Copy, Clone)]
7pub(crate) struct DummyRng;
8
9impl TryRng for DummyRng {
10    type Error = Infallible;
11    fn try_next_u32(&mut self) -> Result<u32, Self::Error> {
12        unimplemented!();
13    }
14
15    fn try_next_u64(&mut self) -> Result<u64, Self::Error> {
16        unimplemented!();
17    }
18
19    fn try_fill_bytes(&mut self, _: &mut [u8]) -> Result<(), Self::Error> {
20        unimplemented!();
21    }
22}
23
24impl TryCryptoRng for DummyRng {}