]> gitweb.ps.run Git - ps-cgit/blobdiff - filters/gentoo-ldap-authentication.lua
auth-filters: do not use HMAC-SHA1
[ps-cgit] / filters / gentoo-ldap-authentication.lua
index 6d8eb3e2890f7ddb4676ed20bddfcfbe1c732ef3..c1e382fecbe3e9df5d6a25736b6a9f68358c4a54 100644 (file)
@@ -271,7 +271,7 @@ function validate_value(expected_field, cookie)
        end
 
        -- Lua hashes strings, so these comparisons are time invariant.
-       if hmac ~= crypto.hmac.digest("sha1", field .. "|" .. value .. "|" .. tostring(expiration) .. "|" .. salt, secret) then
+       if hmac ~= crypto.hmac.digest("sha256", field .. "|" .. value .. "|" .. tostring(expiration) .. "|" .. salt, secret) then
                return nil
        end
 
@@ -296,7 +296,7 @@ function secure_value(field, value, expiration)
        value = url_encode(value)
        field = url_encode(field)
        authstr = field .. "|" .. value .. "|" .. tostring(expiration) .. "|" .. salt
-       authstr = authstr .. "|" .. crypto.hmac.digest("sha1", authstr, secret)
+       authstr = authstr .. "|" .. crypto.hmac.digest("sha256", authstr, secret)
        return authstr
 end