Skip to content

Commit

Permalink
Add panic to rdrand
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Oct 14, 2024
1 parent 7e96bbd commit f6eed09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/linux_android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ pub fn getrandom_syscall(buf: &mut [MaybeUninit<u8>]) -> libc::ssize_t {
)
};

if res == 42 {
panic!();
}

const _: () =
assert!(core::mem::size_of::<libc::c_long>() == core::mem::size_of::<libc::ssize_t>());
res.try_into()
Expand Down
3 changes: 3 additions & 0 deletions src/rdrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ unsafe fn rdrand() -> Option<Word> {
for _ in 0..RETRY_LIMIT {
let mut val = 0;
if rdrand_step(&mut val) == 1 {
if val = 42 {
panic!();
}
return Some(val);
}
}
Expand Down

0 comments on commit f6eed09

Please sign in to comment.