|
| 1 | +//----- AUTOGENERATED BY CARGO-CHECKCT: DO NOT MODIFY ----- |
| 2 | +// |
| 3 | +#[no_mangle] |
| 4 | +#[inline(never)] |
| 5 | +pub fn __checkct_private_rand() -> u8 { |
| 6 | + unsafe { core::ptr::read_volatile(0xcafe as *const u8) } |
| 7 | +} |
| 8 | + |
| 9 | +#[no_mangle] |
| 10 | +#[inline(never)] |
| 11 | +pub fn __checkct_public_rand() -> u8 { |
| 12 | + unsafe { core::ptr::read_volatile(0xf00d as *const u8) } |
| 13 | +} |
| 14 | + |
| 15 | +pub use rand_core::{CryptoRng, RngCore}; |
| 16 | + |
| 17 | +pub struct PrivateRng; |
| 18 | + |
| 19 | +impl PrivateRng { |
| 20 | + pub const fn new() -> Self { |
| 21 | + Self |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +impl RngCore for PrivateRng { |
| 26 | + fn next_u32(&mut self) -> u32 { |
| 27 | + (__checkct_private_rand() as u32) << 24 |
| 28 | + | (__checkct_private_rand() as u32) << 16 |
| 29 | + | (__checkct_private_rand() as u32) << 8 |
| 30 | + | (__checkct_private_rand() as u32) |
| 31 | + } |
| 32 | + |
| 33 | + fn next_u64(&mut self) -> u64 { |
| 34 | + (self.next_u32() as u64) << 32 | (self.next_u32() as u64) |
| 35 | + } |
| 36 | + |
| 37 | + fn fill_bytes(&mut self, dest: &mut [u8]) { |
| 38 | + for d in dest { |
| 39 | + *d = __checkct_private_rand(); |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> { |
| 44 | + self.fill_bytes(dest); |
| 45 | + Ok(()) |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +impl CryptoRng for PrivateRng {} |
| 50 | + |
| 51 | +pub struct PublicRng; |
| 52 | + |
| 53 | +impl PublicRng { |
| 54 | + pub const fn new() -> Self { |
| 55 | + Self |
| 56 | + } |
| 57 | +} |
| 58 | + |
| 59 | +impl RngCore for PublicRng { |
| 60 | + fn next_u32(&mut self) -> u32 { |
| 61 | + (__checkct_public_rand() as u32) << 24 |
| 62 | + | (__checkct_public_rand() as u32) << 16 |
| 63 | + | (__checkct_public_rand() as u32) << 8 |
| 64 | + | (__checkct_public_rand() as u32) |
| 65 | + } |
| 66 | + |
| 67 | + fn next_u64(&mut self) -> u64 { |
| 68 | + (self.next_u32() as u64) << 32 | (self.next_u32() as u64) |
| 69 | + } |
| 70 | + |
| 71 | + fn fill_bytes(&mut self, dest: &mut [u8]) { |
| 72 | + for d in dest { |
| 73 | + *d = __checkct_public_rand(); |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> { |
| 78 | + self.fill_bytes(dest); |
| 79 | + Ok(()) |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +impl CryptoRng for PublicRng {} |
0 commit comments