mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Do not use functions from crypto module wherever possible
This commit is contained in:
parent
b7c7d2747b
commit
a87b475361
@ -237,7 +237,7 @@ response(KeyVals, User, Passwd, Nonce, AuthzId,
|
||||
DigestURI = proplists_get_bin_value(<<"digest-uri">>, KeyVals, <<>>),
|
||||
NC = proplists_get_bin_value(<<"nc">>, KeyVals, <<>>),
|
||||
QOP = proplists_get_bin_value(<<"qop">>, KeyVals, <<>>),
|
||||
MD5Hash = crypto:md5(<<User/binary, ":", Realm/binary, ":",
|
||||
MD5Hash = erlang:md5(<<User/binary, ":", Realm/binary, ":",
|
||||
Passwd/binary>>),
|
||||
A1 = case AuthzId of
|
||||
<<"">> ->
|
||||
@ -253,7 +253,7 @@ response(KeyVals, User, Passwd, Nonce, AuthzId,
|
||||
<<A2Prefix/binary, ":", DigestURI/binary,
|
||||
":00000000000000000000000000000000">>
|
||||
end,
|
||||
T = <<(hex((crypto:md5(A1))))/binary, ":", Nonce/binary,
|
||||
T = <<(hex((erlang:md5(A1))))/binary, ":", Nonce/binary,
|
||||
":", NC/binary, ":", CNonce/binary, ":", QOP/binary,
|
||||
":", (hex((crypto:md5(A2))))/binary>>,
|
||||
hex((crypto:md5(T))).
|
||||
":", (hex((erlang:md5(A2))))/binary>>,
|
||||
hex((erlang:md5(T))).
|
||||
|
@ -284,7 +284,7 @@ handle_sync_event({http_put, Key, NewKey, Packet},
|
||||
Allow = case StateData#state.key of
|
||||
<<"">> -> true;
|
||||
OldKey ->
|
||||
NextKey = jlib:encode_base64((crypto:sha(Key))),
|
||||
NextKey = jlib:encode_base64((p1_sha:sha1(Key))),
|
||||
if OldKey == NextKey -> true;
|
||||
true -> false
|
||||
end
|
||||
|
@ -2447,7 +2447,7 @@ get_port_data(PortIP, Opts) ->
|
||||
io_lib:format("~.16b", [N])
|
||||
end,
|
||||
binary_to_list(
|
||||
crypto:md5(
|
||||
erlang:md5(
|
||||
[SPort, IPS, atom_to_list(NetProt)])))),
|
||||
{Port, SPort, IPT, IPS, SSPort, NetProt, OptsClean}.
|
||||
|
||||
|
@ -467,8 +467,8 @@ make_disco_hash(DiscoEls, Algo) ->
|
||||
Concat = list_to_binary([concat_identities(DiscoEls),
|
||||
concat_features(DiscoEls), concat_info(DiscoEls)]),
|
||||
jlib:encode_base64(case Algo of
|
||||
md5 -> crypto:md5(Concat);
|
||||
sha1 -> crypto:sha(Concat);
|
||||
md5 -> erlang:md5(Concat);
|
||||
sha1 -> p1_sha:sha1(Concat);
|
||||
sha224 -> p1_sha:sha224(Concat);
|
||||
sha256 -> p1_sha:sha256(Concat);
|
||||
sha384 -> p1_sha:sha384(Concat);
|
||||
|
@ -46,7 +46,7 @@ client_key(SaltedPassword) ->
|
||||
|
||||
-spec stored_key(binary()) -> binary().
|
||||
|
||||
stored_key(ClientKey) -> crypto:sha(ClientKey).
|
||||
stored_key(ClientKey) -> p1_sha:sha1(ClientKey).
|
||||
|
||||
-spec server_key(binary()) -> binary().
|
||||
|
||||
|
@ -254,11 +254,11 @@ response(User, Passwd, Nonce, AuthzId, Realm, CNonce,
|
||||
DigestURI, NC, QOP, A2Prefix) ->
|
||||
A1 = case AuthzId of
|
||||
<<"">> ->
|
||||
<<((crypto:md5(<<User/binary, ":", Realm/binary, ":",
|
||||
<<((erlang:md5(<<User/binary, ":", Realm/binary, ":",
|
||||
Passwd/binary>>)))/binary,
|
||||
":", Nonce/binary, ":", CNonce/binary>>;
|
||||
_ ->
|
||||
<<((crypto:md5(<<User/binary, ":", Realm/binary, ":",
|
||||
<<((erlang:md5(<<User/binary, ":", Realm/binary, ":",
|
||||
Passwd/binary>>)))/binary,
|
||||
":", Nonce/binary, ":", CNonce/binary, ":",
|
||||
AuthzId/binary>>
|
||||
@ -270,10 +270,10 @@ response(User, Passwd, Nonce, AuthzId, Realm, CNonce,
|
||||
<<A2Prefix/binary, ":", DigestURI/binary,
|
||||
":00000000000000000000000000000000">>
|
||||
end,
|
||||
T = <<(hex((crypto:md5(A1))))/binary, ":", Nonce/binary,
|
||||
T = <<(hex((erlang:md5(A1))))/binary, ":", Nonce/binary,
|
||||
":", NC/binary, ":", CNonce/binary, ":", QOP/binary,
|
||||
":", (hex((crypto:md5(A2))))/binary>>,
|
||||
hex((crypto:md5(T))).
|
||||
":", (hex((erlang:md5(A2))))/binary>>,
|
||||
hex((erlang:md5(T))).
|
||||
|
||||
my_jid(Config) ->
|
||||
jlib:make_jid(?config(user, Config),
|
||||
|
Loading…
Reference in New Issue
Block a user