mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge pull request #888 from finnmglas/finn/constant-time-pw-verify
use constant-time password verification
This commit is contained in:
commit
b9d4b0578d
1 changed files with 4 additions and 20 deletions
|
|
@ -882,28 +882,12 @@ impl<'a> RootKeys {
|
||||||
unsafe {
|
unsafe {
|
||||||
match pw_type {
|
match pw_type {
|
||||||
PasswordType::Boot => {
|
PasswordType::Boot => {
|
||||||
if (*pcache_ptr).hashed_boot_pw_valid == 1 {
|
(*pcache_ptr).hashed_boot_pw_valid == 1
|
||||||
for (&src, &dst) in digest.iter().zip((*pcache_ptr).hashed_boot_pw.iter()) {
|
&& bool::from(digest.ct_eq(&(*pcache_ptr).hashed_boot_pw))
|
||||||
if dst != src {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PasswordType::Update => {
|
PasswordType::Update => {
|
||||||
if (*pcache_ptr).hashed_update_pw_valid == 1 {
|
(*pcache_ptr).hashed_update_pw_valid == 1
|
||||||
for (&src, &dst) in digest.iter().zip((*pcache_ptr).hashed_update_pw.iter()) {
|
&& bool::from(digest.ct_eq(&(*pcache_ptr).hashed_update_pw))
|
||||||
if dst != src {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue