mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
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:
parent
e8380aa0e7
commit
c71f472743
1 changed files with 2 additions and 2 deletions
|
|
@ -224,7 +224,7 @@ impl HardenedBool {
|
||||||
const TRUE_VALUE: u32 = 0x5A5A_A5A5;
|
const TRUE_VALUE: u32 = 0x5A5A_A5A5;
|
||||||
|
|
||||||
/// Check if true - returns None if value is corrupted
|
/// Check if true - returns None if value is corrupted
|
||||||
#[inline(never)]
|
#[inline(always)]
|
||||||
pub fn is_true(self) -> Option<bool> {
|
pub fn is_true(self) -> Option<bool> {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
Self::TRUE_VALUE => Some(true),
|
Self::TRUE_VALUE => Some(true),
|
||||||
|
|
@ -234,7 +234,7 @@ impl HardenedBool {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constant-time equality check against TRUE
|
/// Constant-time equality check against TRUE
|
||||||
#[inline(never)]
|
#[inline(always)]
|
||||||
pub fn check_true(self) -> bool {
|
pub fn check_true(self) -> bool {
|
||||||
// Use volatile to prevent optimizer from simplifying
|
// Use volatile to prevent optimizer from simplifying
|
||||||
let val = unsafe { core::ptr::read_volatile(&self.0) };
|
let val = unsafe { core::ptr::read_volatile(&self.0) };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue