Commit 35515e46 authored by Parnell Springmeyer's avatar Parnell Springmeyer
Browse files

Improvements re: suggestions from @jlouis.

parent 7e7ac67f
......@@ -522,7 +522,7 @@ ERL_NIF_TERM enif_crypto_sign_detached(ErlNifEnv* env, int argc, ERL_NIF_TERM co
crypto_sign_detached(sig.data, &siglen, m.data, m.size, sk.data);
return enif_make_sub_binary(env, enif_make_binary(env, &sig), 0, siglen);
return enif_make_binary(env, &sig);
}
/*
......
......@@ -398,12 +398,16 @@ sign_detached(M, SK) -> enacl_nif:crypto_sign_detached(M, SK).
%%
%% Given a signature `SIG', a message `M', and a public key `PK', the function computes
%% true iff the `SIG' is valid for `M' and `PK'.
-spec sign_verify_detached(SIG, M, PK) -> boolean()
-spec sign_verify_detached(SIG, M, PK) -> {ok, M} | {error, failed_verification}
when
SIG :: binary(),
M :: iodata(),
PK :: binary().
sign_verify_detached(SIG, M, PK) -> enacl_nif:crypto_sign_verify_detached(SIG, M, PK).
sign_verify_detached(SIG, M, PK) ->
case enacl_nif:crypto_sign_verify_detached(SIG, M, PK) of
true -> {ok, M};
false -> {error, failed_verification}
end.
%% @private
-spec box_secret_key_bytes() -> pos_integer().
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment