aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-03-19 11:50:59 +0100
committerLoïc Hoguin <[email protected]>2019-03-19 12:47:29 +0100
commit520ea3275e932810b3beda1f8c524dc5db9941a9 (patch)
tree4b6be9c9b31484770068f067aeb72b5752c61274
parent47b496da10cfedeea8a0341ce13c76de3c132a57 (diff)
downloadotp-520ea3275e932810b3beda1f8c524dc5db9941a9.tar.gz
otp-520ea3275e932810b3beda1f8c524dc5db9941a9.tar.bz2
otp-520ea3275e932810b3beda1f8c524dc5db9941a9.zip
Make crypto:cipher_info work for all ciphers and aliases
-rw-r--r--lib/crypto/src/crypto.erl4
-rw-r--r--lib/crypto/test/crypto_SUITE.erl6
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 97a4a7a3f0..4df7e6360c 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -540,8 +540,10 @@ poly1305(Key, Data) ->
-spec cipher_info(Type) -> map() when Type :: block_cipher_with_iv()
| aead_cipher()
| block_cipher_without_iv().
+cipher_info(aes_ige256) ->
+ #{block_size => 16,iv_length => 32,key_length => 16,mode => ige_mode,type => undefined};
cipher_info(Type) ->
- cipher_info_nif(Type).
+ cipher_info_nif(alias(Type)).
%%%---- Block ciphers
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 7257f4fb9f..2fbaba5dff 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -674,7 +674,8 @@ cipher_info(Config) when is_list(Config) ->
#{type := _,key_length := _,iv_length := _,
block_size := _,mode := _} = crypto:cipher_info(aes_128_cbc),
{'EXIT',_} = (catch crypto:cipher_info(not_a_cipher)),
- ok.
+ lists:foreach(fun(C) -> crypto:cipher_info(C) end,
+ proplists:get_value(ciphers, crypto:supports())).
%%--------------------------------------------------------------------
hash_info() ->
@@ -682,7 +683,8 @@ hash_info() ->
hash_info(Config) when is_list(Config) ->
#{type := _,size := _,block_size := _} = crypto:hash_info(sha256),
{'EXIT',_} = (catch crypto:hash_info(not_a_hash)),
- ok.
+ lists:foreach(fun(H) -> crypto:hash_info(H) end,
+ proplists:get_value(hashs, crypto:supports())).
%%--------------------------------------------------------------------
%% Internal functions ------------------------------------------------