aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-03-20 13:56:02 +0100
committerHans Nilsson <[email protected]>2019-03-22 10:23:48 +0100
commitfc234a9945f00e8e90e62560bd2662caee5deefb (patch)
tree0a803e4fccdd2949f12738b8ee7195d98c272a27 /lib/crypto
parent89236bc46fd3a7de0dbb9df2390c30e7333f6bdb (diff)
downloadotp-fc234a9945f00e8e90e62560bd2662caee5deefb.tar.gz
otp-fc234a9945f00e8e90e62560bd2662caee5deefb.tar.bz2
otp-fc234a9945f00e8e90e62560bd2662caee5deefb.zip
crypto: Declare *_info return map and other review-comments
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/src/crypto.erl21
1 files changed, 17 insertions, 4 deletions
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) ->