Introduce a scalarmult variant which is safe from arguments swaps.
This commit is contained in:
parent
8c567be6a6
commit
66cf275152
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
%% Curve 25519.
|
%% Curve 25519.
|
||||||
-export([
|
-export([
|
||||||
curve25519_scalarmult/2
|
curve25519_scalarmult/1, curve25519_scalarmult/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
%% Ed 25519.
|
%% Ed 25519.
|
||||||
@ -689,6 +689,13 @@ onetime_auth_key_size() -> enacl_nif:crypto_onetimeauth_KEYBYTES().
|
|||||||
curve25519_scalarmult(Secret, BasePoint) ->
|
curve25519_scalarmult(Secret, BasePoint) ->
|
||||||
enacl_nif:crypto_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
|
%% Ed 25519 Crypto
|
||||||
%% ---------------
|
%% ---------------
|
||||||
%% @doc crypto_sign_ed25519_keypair/0 creates a new Ed 25519 Public/Secret keypair.
|
%% @doc crypto_sign_ed25519_keypair/0 creates a new Ed 25519 Public/Secret keypair.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user