Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
0236-crypto-replace-size-1-by-byte_size-1.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0236-crypto-replace-size-1-by-byte_size-1.patch of Package erlang
From 981a4025fd03d4704138842c07eff1ab27a8006c Mon Sep 17 00:00:00 2001 From: Kiko Fernandez-Reyes <kiko@erlang.org> Date: Wed, 1 Feb 2023 14:46:06 +0100 Subject: [PATCH 1/2] crypto: replace size/1 by byte_size/1 The <c>size/1</c> BIF is not optimized by the JIT, and its use can result in worse types for Dialyzer. When one knows that the value being tested must be a tuple, <c>tuple_size/1</c> should always be preferred. When one knows that the value being tested must be a binary, <c>byte_size/1</c> should be preferred. --- lib/crypto/src/crypto.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 7c1e1d188b..32cbf89738 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -1282,7 +1282,7 @@ rand_plugin_aes_next(Key, GenWords, F, Count) -> {V,Cache}. block_encrypt(Key, Data) -> - Cipher = case size(Key) of + Cipher = case byte_size(Key) of 16 -> aes_128_ecb; 24 -> aes_192_ecb; 32 -> aes_256_ecb; @@ -2276,7 +2276,7 @@ srp_pad_length(Width, Length) -> (Width - Length rem Width) rem Width. srp_pad_to(Width, Binary) -> - case srp_pad_length(Width, size(Binary)) of + case srp_pad_length(Width, byte_size(Binary)) of 0 -> Binary; N -> << 0:(N*8), Binary/binary>> end. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor