mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Make RPC password resistant to timing attacks
Fixes issue#2838; this is a tweaked version of pull#2845 that should not leak the length of the password and is more generic, in case we run into other situations where we need timing-attack-resistant comparisons.
This commit is contained in:
parent
6cc766fa55
commit
42656ea2e5
3 changed files with 27 additions and 1 deletions
|
|
@ -476,7 +476,7 @@ bool HTTPAuthorized(map<string, string>& mapHeaders)
|
|||
return false;
|
||||
string strUserPass64 = strAuth.substr(6); boost::trim(strUserPass64);
|
||||
string strUserPass = DecodeBase64(strUserPass64);
|
||||
return strUserPass == strRPCUserColonPass;
|
||||
return TimingResistantEqual(strUserPass, strRPCUserColonPass);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue