diff options
Diffstat (limited to 'src/monocypher.erl')
-rw-r--r-- | src/monocypher.erl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/monocypher.erl b/src/monocypher.erl index 41c5c24..eca8fc4 100644 --- a/src/monocypher.erl +++ b/src/monocypher.erl @@ -9,6 +9,9 @@ crypto_blake2b_general/3]). -export([crypto_ietf_chacha20/3, crypto_ietf_chacha20_ctr/4]). +-export([crypto_ed25519_public_key/1, + crypto_ed25519_sign/3, + crypto_ed25519_check/3]). -on_load(init/0). -define(APPNAME, monocypher). @@ -52,6 +55,26 @@ crypto_ietf_chacha20(_,_,_) -> crypto_ietf_chacha20_ctr(_,_,_,_) -> not_loaded(?LINE). +%% Public Key Signature (Ed25519) + +-type crypto_ed25519_secret_key() :: <<_:256>>. +-type crypto_ed25519_public_key() :: <<_:256>>. +-type crypto_ed25519_signature() :: <<_:512>>. +-type crypto_ed25519_message() :: <<_:_*8>>. + +-spec crypto_ed25519_public_key(crypto_ed25519_secret_key()) -> crypto_ed25519_public_key(). +crypto_ed25519_public_key(_) -> + not_loaded(?LINE). + +-spec crypto_ed25519_sign(crypto_ed25519_secret_key(), crypto_ed25519_public_key(), crypto_ed25519_message()) -> crypto_ed25519_signature(). +crypto_ed25519_sign(_,_,_) -> + not_loaded(?LINE). + +-spec crypto_ed25519_check(crypto_ed25519_signature(), crypto_ed25519_public_key(), crypto_ed25519_message()) -> 'ok' | 'forgery'. +crypto_ed25519_check(_,_,_) -> + not_loaded(?LINE). + + init() -> SoName = case code:priv_dir(?APPNAME) of {error, bad_name} -> |