diff options
author | Ingela Anderton Andin <[email protected]> | 2018-12-07 15:57:36 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2018-12-12 23:45:29 +0100 |
commit | 4a03901ed227a95bcd8a8d4e48088688f20dedb0 (patch) | |
tree | 63731b3da00b033cb000972b6503edc8e285bc74 /lib/ssl | |
parent | 9fd877fd2eac46c9491266620ac942d212841259 (diff) | |
download | otp-4a03901ed227a95bcd8a8d4e48088688f20dedb0.tar.gz otp-4a03901ed227a95bcd8a8d4e48088688f20dedb0.tar.bz2 otp-4a03901ed227a95bcd8a8d4e48088688f20dedb0.zip |
ssl: Use binary:copy/2 to avoid list overhead
Diffstat (limited to 'lib/ssl')
-rw-r--r-- | lib/ssl/src/ssl_cipher.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl index 54c04c13e5..66a00c60f1 100644 --- a/lib/ssl/src/ssl_cipher.erl +++ b/lib/ssl/src/ssl_cipher.erl @@ -889,7 +889,7 @@ is_correct_padding(GenBlockCipher, {3, 1}, false) -> is_correct_padding(#generic_block_cipher{padding_length = Len, padding = Padding}, _, _) -> Len == byte_size(Padding) andalso - list_to_binary(lists:duplicate(Len, Len)) == Padding. + binary:copy(?byte(Len), Len) == Padding. get_padding(Length, BlockSize) -> get_padding_aux(BlockSize, Length rem BlockSize). @@ -898,7 +898,7 @@ get_padding_aux(_, 0) -> {0, <<>>}; get_padding_aux(BlockSize, PadLength) -> N = BlockSize - PadLength, - {N, list_to_binary(lists:duplicate(N, N))}. + {N, binary:copy(?byte(N), N)}. random_iv(IV) -> IVSz = byte_size(IV), |