Commit 66cf2751 authored by Jesper Louis Andersen's avatar Jesper Louis Andersen
Browse files

Introduce a scalarmult variant which is safe from arguments swaps.

parent 8c567be6
......@@ -67,7 +67,7 @@
%% Curve 25519.
-export([
curve25519_scalarmult/2
curve25519_scalarmult/1, curve25519_scalarmult/2
]).
%% Ed 25519.
......@@ -689,6 +689,13 @@ onetime_auth_key_size() -> enacl_nif:crypto_onetimeauth_KEYBYTES().
curve25519_scalarmult(Secret, BasePoint) ->
enacl_nif:crypto_curve25519_scalarmult(Secret, BasePoint).
%% @doc curve25519_scalarmult/1 avoids messing up arguments.
%% Takes as input a map `#{ secret := Secret, base_point := BasePoint }' in order to avoid
%% messing up the calling order.
%% @end
curve25519_scalarmult(#{ secret := Secret, base_point := BasePoint }) ->
curve25519_scalarmult(Secret, BasePoint).
%% Ed 25519 Crypto
%% ---------------
%% @doc crypto_sign_ed25519_keypair/0 creates a new Ed 25519 Public/Secret keypair.
......
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