summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2020-12-03 17:09:58 +0100
committerpukkamustard <pukkamustard@posteo.net>2020-12-03 17:09:58 +0100
commitb46391bbb8d0ea750d9a0b3129b9a6f5c7973b79 (patch)
tree17615fd0bf8e0498c8d9341ae7c3b8c36f8b24e4 /src
parent414e4eb55750090ccae9001797a89351bf2722fd (diff)
monocypher: add crypto_ed25519_* functions.
Diffstat (limited to 'src')
-rw-r--r--src/monocypher.erl23
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} ->