summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b826537)
By default, strings are compared by hash, so we can remove this comment.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
- -- TODO: Implement time invariant string comparison function to mitigate timing attack.
+ -- Lua hashes strings, so these comparisons are time invariant.
if password == nil or password ~= post["password"] then
set_cookie("cgitauth", "")
else
if password == nil or password ~= post["password"] then
set_cookie("cgitauth", "")
else
- -- TODO: implement time invariant comparison to prevent against timing attack.
+ -- Lua hashes strings, so these comparisons are time invariant.
if hmac ~= crypto.hmac.digest("sha1", value .. "|" .. tostring(expiration) .. "|" .. salt, secret) then
return nil
end
if hmac ~= crypto.hmac.digest("sha1", value .. "|" .. tostring(expiration) .. "|" .. salt, secret) then
return nil
end