25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Fix more places that needed changes after scram.erl api modifications

This commit is contained in:
Paweł Chmielowski 2020-12-04 09:20:59 +01:00
parent 0371b0f664
commit 72867f8d1e

View File

@ -754,8 +754,8 @@ is_password_scram_valid(Password, Scram) ->
_ -> _ ->
IterationCount = Scram#scram.iterationcount, IterationCount = Scram#scram.iterationcount,
Salt = base64:decode(Scram#scram.salt), Salt = base64:decode(Scram#scram.salt),
SaltedPassword = scram:salted_password(Password, Salt, IterationCount), SaltedPassword = scram:salted_password(sha, Password, Salt, IterationCount),
StoredKey = scram:stored_key(scram:client_key(SaltedPassword)), StoredKey = scram:stored_key(sha, scram:client_key(sha, SaltedPassword)),
base64:decode(Scram#scram.storedkey) == StoredKey base64:decode(Scram#scram.storedkey) == StoredKey
end. end.
@ -766,9 +766,9 @@ password_to_scram(#scram{} = Password, _IterationCount) ->
Password; Password;
password_to_scram(Password, IterationCount) -> password_to_scram(Password, IterationCount) ->
Salt = p1_rand:bytes(?SALT_LENGTH), Salt = p1_rand:bytes(?SALT_LENGTH),
SaltedPassword = scram:salted_password(Password, Salt, IterationCount), SaltedPassword = scram:salted_password(sha, Password, Salt, IterationCount),
StoredKey = scram:stored_key(scram:client_key(SaltedPassword)), StoredKey = scram:stored_key(sha, scram:client_key(sha, SaltedPassword)),
ServerKey = scram:server_key(SaltedPassword), ServerKey = scram:server_key(sha, SaltedPassword),
#scram{storedkey = base64:encode(StoredKey), #scram{storedkey = base64:encode(StoredKey),
serverkey = base64:encode(ServerKey), serverkey = base64:encode(ServerKey),
salt = base64:encode(Salt), salt = base64:encode(Salt),