server_cb: Fix issue with Erlang/OTP 24

Erlang/OTP 24 dropped crypto:hmac, so use crpyto:mac(hmac, ...) instead.

See https://github.com/riverrun/one_time_pass_ecto/issues/9

Change-Id: I7d916eb1f1435b3ac3fc362bb2f4daa7bbb8bb1a
changes/96/27896/3
Daniel Willmann 2022-04-22 16:08:48 +02:00 committed by Harald Welte
parent bf59e9dc7e
commit 592cc8bc19
1 changed files with 7 additions and 1 deletions

View File

@ -85,7 +85,13 @@ compute_kasme(Ck, Ik, VplmnId, Autn) ->
Autn6 = binary_part(Autn, 0, 6),
K = <<Ck:16/binary, Ik:16/binary>>,
S = <<16, VplmnId:3/binary, 0, 3, Autn6:6/binary, 0, 6>>,
crypto:hmac(sha256, K, S, 32).
Release = erlang:system_info(otp_release),
if
Release >= "24" ->
crypto:macN(hmac, sha256, K, S, 32);
true ->
crypto:hmac(sha256, K, S, 32)
end.
-spec req_num_of_vec([tuple()]) -> int_or_false().
req_num_of_vec([#'Requested-EUTRAN-Authentication-Info'{'Number-Of-Requested-Vectors'=[]}]) -> false;