Replace case with a simpler assertion
This commit is contained in:
@@ -342,14 +342,10 @@ extract(Hash, Salt, IKM) ->
|
||||
expand(Hash, PRK, Info, OutLen) ->
|
||||
HashLen = hash_size(Hash),
|
||||
BlockCount = (OutLen + HashLen - 1) div HashLen,
|
||||
case BlockCount > 255 of
|
||||
true ->
|
||||
error(hkdf_length_too_long);
|
||||
false ->
|
||||
FullBlocks = expand_loop(Hash, PRK, Info, BlockCount, 1, <<>>, <<>>),
|
||||
<<Output:OutLen/binary, _/binary>> = FullBlocks,
|
||||
Output
|
||||
end.
|
||||
true = BlockCount =< 255,
|
||||
FullBlocks = expand_loop(Hash, PRK, Info, BlockCount, 1, <<>>, <<>>),
|
||||
<<Output:OutLen/binary, _/binary>> = FullBlocks,
|
||||
Output.
|
||||
|
||||
expand_loop(Hash, PRK, Info, N, Counter, PrevT, Acc) when Counter =< N ->
|
||||
Payload = <<PrevT/binary, Info/binary, Counter:8>>,
|
||||
|
||||
Reference in New Issue
Block a user