Const time comparison (#8113)
* Use `subtle::slices_equal` for constant time comparison. Also update the existing version of subtle in `ethcrypto` from 0.1 to 0.5 * Test specifically for InvalidPassword error.
This commit is contained in:
committed by
Marek Kotewicz
parent
322dfbcd78
commit
236692cfd5
@@ -308,7 +308,7 @@ pub mod ecies {
|
||||
hmac.raw_result(&mut mac);
|
||||
|
||||
// constant time compare to avoid timing attack.
|
||||
if ::subtle::arrays_equal(&mac[..], msg_mac) != 1 {
|
||||
if ::subtle::slices_equal(&mac[..], msg_mac) != 1 {
|
||||
return Err(Error::InvalidMessage);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user