Skip to content

Commit 5389509

Browse files
tverlaanbearice
authored andcommitted
update crypto usage to otp 22 and up
warning: :crypto.hmac/3 is undefined or private, use crypto:mac/4 instead lib/radius/packet.ex:233: Radius.Packet.encode/2
1 parent 6559806 commit 5389509

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/radius/packet.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ defmodule Radius.Packet do
230230

231231
attrs =
232232
if sign? do
233-
signature = :crypto.hmac(:md5, packet.secret, [header, attrs])
233+
signature = :crypto.mac(:hmac, :md5, packet.secret, [header, attrs])
234234
[last | attrs] = attrs |> Enum.reverse()
235235
crop_len = byte_size(last) - 16
236236
last = <<last::bytes-size(crop_len), signature::binary>>
@@ -391,7 +391,7 @@ defmodule Radius.Packet do
391391
do: encode_vsa(Vendor.by_name(vid).id, value, ctx)
392392

393393
defp encode_vsa(vid, value, _) when is_binary(value) and is_integer(vid),
394-
do: <<vid::size(32), value>>
394+
do: <<vid::size(32), value::binary>>
395395

396396
defp encode_vsa(vid, vsa, ctx) when is_tuple(vsa), do: encode_vsa(vid, [vsa], ctx)
397397

0 commit comments

Comments
 (0)