fix in-line directive on hardened bool

this prevents there being a single "hot spot" to attack for
hardened bool testing
This commit is contained in:
bunnie 2026-02-15 03:20:54 +08:00
parent e8380aa0e7
commit c71f472743
No known key found for this signature in database

View file

@ -224,7 +224,7 @@ impl HardenedBool {
const TRUE_VALUE: u32 = 0x5A5A_A5A5;
/// Check if true - returns None if value is corrupted
#[inline(never)]
#[inline(always)]
pub fn is_true(self) -> Option<bool> {
match self.0 {
Self::TRUE_VALUE => Some(true),
@ -234,7 +234,7 @@ impl HardenedBool {
}
/// Constant-time equality check against TRUE
#[inline(never)]
#[inline(always)]
pub fn check_true(self) -> bool {
// Use volatile to prevent optimizer from simplifying
let val = unsafe { core::ptr::read_volatile(&self.0) };