summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/monocypher.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/monocypher.erl b/src/monocypher.erl
index acdf488..41c5c24 100644
--- a/src/monocypher.erl
+++ b/src/monocypher.erl
@@ -16,11 +16,14 @@
%% Authenticated Encryption
--spec crypto_lock(binary(), binary(), binary(), binary()) -> binary().
+-type crypto_lock_mac() :: <<_:128>>.
+-type crypto_lock_key() :: <<_:256>>.
+-type crypto_lock_nonce() :: <<_:192>>.
+-spec crypto_lock(crypto_lock_mac(), crypto_lock_key(), crypto_lock_nonce(), binary()) -> binary().
crypto_lock(_,_,_,_) ->
not_loaded(?LINE).
--spec crypto_unlock(binary(), binary(), binary(), binary()) -> {'ok', binary()} | {'error', integer()}.
+-spec crypto_unlock(crypto_lock_key(), crypto_lock_nonce(), crypto_lock_mac(), binary()) -> {'ok', binary()} | {'error', integer()}.
crypto_unlock(_,_,_,_) ->
not_loaded(?LINE).
@@ -30,17 +33,22 @@ crypto_unlock(_,_,_,_) ->
crypto_blake2b(_) ->
not_loaded(?LINE).
--spec crypto_blake2b_general(integer(), binary(), binary()) -> binary().
+
+-type crypto_blake2b_hash_size() :: 1..64.
+-type crypto_blake2b_key() :: <<_:_*8>>.
+-spec crypto_blake2b_general(crypto_blake2b_hash_size(), crypto_blake2b_key(), binary()) -> binary().
crypto_blake2b_general(_,_,_) ->
not_loaded(?LINE).
%% IETF ChaCha20
--spec crypto_ietf_chacha20(binary(), binary(), binary()) -> binary().
+-type crypto_ietf_chacha20_key() :: <<_:256>>.
+-type crypto_ietf_chacha20_nonce() :: <<_:96>>.
+-spec crypto_ietf_chacha20(binary(), crypto_ietf_chacha20_key(), crypto_ietf_chacha20_nonce()) -> binary().
crypto_ietf_chacha20(_,_,_) ->
not_loaded(?LINE).
--spec crypto_ietf_chacha20_ctr(binary(), binary(), binary(), pos_integer()) -> binary().
+-spec crypto_ietf_chacha20_ctr(binary(), crypto_ietf_chacha20_key(), crypto_ietf_chacha20_nonce(), pos_integer()) -> binary().
crypto_ietf_chacha20_ctr(_,_,_,_) ->
not_loaded(?LINE).