2323% % Supported ciphers and hashes
2424
2525supported_ciphers () ->
26- NotSupportedByUs = [aes_ccm , aes_ctr , aes_ecb , aes_gcm ,
26+ NotSupportedByUs = [% % These ciphers should be supported in a future version.
27+ aes_128_ccm , aes_192_ccm , aes_256_ccm ,
28+ aes_128_ctr , aes_192_ctr , aes_256_ctr ,
29+ aes_128_gcm , aes_192_gcm , aes_256_gcm ,
2730 chacha20 , chacha20_poly1305 ,
28- blowfish_ecb , des_ecb , rc4 ],
31+ % % These are aliases that correspond to multiple ciphers.
32+ aes_ccm , aes_ctr , aes_gcm ,
33+ % % These ciphers will never be supported.
34+ aes_ecb , blowfish_ecb , des_ecb , rc4 ],
2935 SupportedByCrypto = proplists :get_value (ciphers , crypto :supports ()),
3036 lists :filter (fun (Cipher ) ->
3137 not lists :member (Cipher , NotSupportedByUs )
@@ -89,7 +95,9 @@ make_key(Cipher, Hash, Iterations, PassPhrase, Salt) ->
8995 Key = pbdkdf2 (PassPhrase , Salt , Iterations , key_length (Cipher ),
9096 fun crypto :hmac /4 , Hash , hash_length (Hash )),
9197 if
92- Cipher =:= des3_cbc ; Cipher =:= des3_cbf ; Cipher =:= des3_cfb ; Cipher =:= des_ede3 ->
98+ Cipher =:= des3_cbc ; Cipher =:= des3_cbf ; Cipher =:= des3_cfb ;
99+ Cipher =:= des_ede3 ; Cipher =:= des_ede3_cbc ;
100+ Cipher =:= des_ede3_cbf ; Cipher =:= des_ede3_cfb ->
93101 << A :8 /binary , B :8 /binary , C :8 /binary >> = Key ,
94102 [A , B , C ];
95103 true ->
@@ -126,14 +134,19 @@ hash_length(sha3_256) -> 32;
126134hash_length (sha384 ) -> 48 ;
127135hash_length (sha3_384 ) -> 48 ;
128136hash_length (sha512 ) -> 64 ;
129- hash_length (sha3_512 ) -> 64 .
137+ hash_length (sha3_512 ) -> 64 ;
138+ hash_length (blake2b ) -> 64 ;
139+ hash_length (blake2s ) -> 32 .
130140
131141iv_length (des_cbc ) -> 8 ;
132142iv_length (des_cfb ) -> 8 ;
133143iv_length (des3_cbc ) -> 8 ;
134144iv_length (des3_cbf ) -> 8 ;
135145iv_length (des3_cfb ) -> 8 ;
136146iv_length (des_ede3 ) -> 8 ;
147+ iv_length (des_ede3_cbf ) -> 8 ;
148+ iv_length (des_ede3_cfb ) -> 8 ;
149+ iv_length (des_ede3_cbc ) -> 8 ;
137150iv_length (blowfish_cbc ) -> 8 ;
138151iv_length (blowfish_cfb64 ) -> 8 ;
139152iv_length (blowfish_ofb64 ) -> 8 ;
@@ -143,6 +156,9 @@ iv_length(aes_cbc128) -> 16;
143156iv_length (aes_cfb8 ) -> 16 ;
144157iv_length (aes_cfb128 ) -> 16 ;
145158iv_length (aes_cbc256 ) -> 16 ;
159+ iv_length (aes_128_cbc ) -> 16 ;
160+ iv_length (aes_192_cbc ) -> 16 ;
161+ iv_length (aes_256_cbc ) -> 16 ;
146162iv_length (aes_ige256 ) -> 32 .
147163
148164key_length (des_cbc ) -> 8 ;
@@ -151,6 +167,9 @@ key_length(des3_cbc) -> 24;
151167key_length (des3_cbf ) -> 24 ;
152168key_length (des3_cfb ) -> 24 ;
153169key_length (des_ede3 ) -> 24 ;
170+ key_length (des_ede3_cbf ) -> 24 ;
171+ key_length (des_ede3_cfb ) -> 24 ;
172+ key_length (des_ede3_cbc ) -> 24 ;
154173key_length (blowfish_cbc ) -> 16 ;
155174key_length (blowfish_cfb64 ) -> 16 ;
156175key_length (blowfish_ofb64 ) -> 16 ;
@@ -160,12 +179,18 @@ key_length(aes_cbc128) -> 16;
160179key_length (aes_cfb8 ) -> 16 ;
161180key_length (aes_cfb128 ) -> 16 ;
162181key_length (aes_cbc256 ) -> 32 ;
182+ key_length (aes_128_cbc ) -> 16 ;
183+ key_length (aes_192_cbc ) -> 24 ;
184+ key_length (aes_256_cbc ) -> 32 ;
163185key_length (aes_ige256 ) -> 16 .
164186
187+ block_size (aes_cbc ) -> 32 ;
165188block_size (aes_cbc256 ) -> 32 ;
166189block_size (aes_cbc128 ) -> 32 ;
190+ block_size (aes_128_cbc ) -> 32 ;
191+ block_size (aes_192_cbc ) -> 32 ;
192+ block_size (aes_256_cbc ) -> 32 ;
167193block_size (aes_ige256 ) -> 32 ;
168- block_size (aes_cbc ) -> 32 ;
169194block_size (_ ) -> 8 .
170195
171196% % The following was taken from OTP's lib/public_key/src/pubkey_pbe.erl
0 commit comments