From fc234a9945f00e8e90e62560bd2662caee5deefb Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Wed, 20 Mar 2019 13:56:02 +0100 Subject: crypto: Declare *_info return map and other review-comments --- lib/crypto/src/crypto.erl | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'lib/crypto/src/crypto.erl') diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 070949a1d9..b6715e83c0 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -414,8 +414,12 @@ enable_fips_mode(_) -> ?nif_stub. -define(HASH_HASH_ALGORITHM, sha1() | sha2() | sha3() | blake2() | ripemd160 | compatibility_only_hash() ). --spec hash_info(Type) -> map() | run_time_error() when Type :: ?HASH_HASH_ALGORITHM. - +-spec hash_info(Type) -> Result | run_time_error() + when Type :: ?HASH_HASH_ALGORITHM, + Result :: #{size := integer(), + block_size := integer(), + type := integer() + } . hash_info(Type) -> notsup_to_error(hash_info_nif(Type)). @@ -554,8 +558,17 @@ poly1305(Key, Data) -> error(E) end). - --spec cipher_info(Type) -> map() | run_time_error() when Type :: cipher() . +%%%---- Cipher info +%%%---------------------------------------------------------------- +-spec cipher_info(Type) -> Result | run_time_error() + when Type :: cipher(), + Result :: #{key_length := integer(), + iv_length := integer(), + block_size := integer(), + mode := CipherModes, + type := undefined | integer() + }, + CipherModes :: ecb_mode | cbc_mode | cfb_mode | ofb_mode | undefined. %% These ciphers are not available via the EVP interface on older cryptolibs. cipher_info(aes_ctr) -> -- cgit v1.2.3