From 09a1b9fd7c50d3025767401db32ee359c1042177 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Sun, 12 Jun 2022 21:14:21 +0800 Subject: [PATCH] Fix typos and add code block to readme --- CHANGELOG.md | 2 +- README.md | 26 ++++++++++++++++++-------- src/enacl.erl | 18 +++++++++--------- src/enacl_ext.erl | 2 +- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2259d9b..ae2908d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -289,7 +289,7 @@ function call, and optimizes EQC tests to make it easier to implement `largebinary`-support in EQC tests. - The release also adds an (experimental) scrambling function for hiding the internal structure of counters. This is based on an -enlarged TEA-cipher by Wheeler and Needham. It is neccessary for +enlarged TEA-cipher by Wheeler and Needham. It is necessary for correct operation of the CurveCP implementation, which is why it is included in this library. diff --git a/README.md b/README.md index 2b1457e..0e738aa 100644 --- a/README.md +++ b/README.md @@ -22,19 +22,27 @@ libsodium. To build the software execute: - make +```sh +make +``` or - rebar compile +```sh +rebar compile +``` To build and run licensed eqc test execute: - make eqc_run +```sh +make eqc_run +``` To build and run eqc-mini version of test execute: - make eqc_mini_run +```sh +make eqc_mini_run +``` ## Features @@ -62,13 +70,15 @@ place. In general, consult the libsodium documentation at [Libsodium documentation](https://download.libsodium.org/doc/) -The original NaCl documentation is nowadays largely superceded by the +The original NaCl documentation is nowadays largely superseded by the libsodium documentation, but it is still worth a visit [NaCl website](https://nacl.cr.yp.to) but also note that our interface has full Edoc documentation, generated by executing - rebar3 doc +```sh +rebar3 doc +``` ## Hints @@ -81,7 +91,7 @@ However, their correct use is still needed in order to be secure: reuse a nonce, and an attacker figures this out, the system will leak the XOR difference of messages sent with the same nonce. Given enough guessing, this can in turn leak the encryption stream of bits - and every message hereafter, sent on the same keypair combination + and every message hereafter, sent on the same key pair combination and reusing that nonce, will be trivially breakable. * Use the beforenm/afternm primitives if using the `box` public-key encryption scheme. Precomputing the Curve25519 operations yields @@ -158,7 +168,7 @@ This implements standard Public/Secret key cryptography. The implementation roughly consists of two major sections: * *Authenticated encryption:* provides a `box` primitive which - encrypts and then also authenticates a message. The reciever is only + encrypts and then also authenticates a message. The receiver is only able to open the sealed box if they posses the secret key and the authentication from the sender is correct. * *Signatures:* allows one party to sign a message (not encrypting it) diff --git a/src/enacl.erl b/src/enacl.erl index 378bb7b..109cbea 100644 --- a/src/enacl.erl +++ b/src/enacl.erl @@ -524,7 +524,7 @@ kdf_derive_from_key(MasterKey, Context, Id) -> %% Public Key Crypto %% --------------------- -%% @doc box_keypair/0 creates a new Public/Secret keypair. +%% @doc box_keypair/0 creates a new Public/Secret key pair. %% %% Generates and returns a new key pair for the Box encryption scheme. The return value is a %% map in order to avoid using the public key as a secret key and vice versa. @@ -566,7 +566,7 @@ box(Msg, Nonce, PK, SK) -> box_open(CipherText, Nonce, PK, SK) -> enacl_nif:crypto_box_open([?P_BOXZEROBYTES, CipherText], Nonce, PK, SK). -%% @doc box_beforenm/2 precomputes a box shared key for a PK/SK keypair +%% @doc box_beforenm/2 precomputes a box shared key for a PK/SK key pair %% @end -spec box_beforenm(PK, SK) -> binary() when @@ -650,7 +650,7 @@ sign_SECRETBYTES() -> sign_SEEDBYTES() -> enacl_nif:crypto_sign_SEEDBYTES(). -%% @doc sign_keypair/0 returns a signature keypair for signing +%% @doc sign_keypair/0 returns a signature key pair for signing %% %% The returned value is a map in order to make it harder to misuse keys. %% @end @@ -659,7 +659,7 @@ sign_keypair() -> {PK, SK} = enacl_nif:crypto_sign_keypair(), #{ public => PK, secret => SK}. -%% @doc sign_seed_keypair/1 returns a signature keypair based on seed for signing +%% @doc sign_seed_keypair/1 returns a signature key pair based on seed for signing %% %% The returned value is a map in order to make it harder to misuse keys. %% @end @@ -769,7 +769,7 @@ box_SECRETKEYBYTES() -> %% @doc seal_box/2 encrypts an anonymous message to another party. %% %% Encrypt a `Msg' to a party using his public key, `PK'. This generates an ephemeral -%% keypair and then uses `box'. Ephemeral public key will sent to other party. Returns the +%% key pair and then uses `box'. Ephemeral public key will sent to other party. Returns the %% enciphered message `SealedCipherText' which includes ephemeral public key at head. %% @end -spec box_seal(Msg, PK) -> SealedCipherText @@ -998,7 +998,7 @@ auth(Msg, Key) -> %% @doc auth_verify/3 verifies an authenticator for a message %% %% Given an `Authenticator', a `Msg' and a `Key'; verify that the MAC for the pair `{Msg, Key}' is really `Authenticator'. Returns -%% the value `true' if the verfication passes. Upon failure, the function returns `false'. +%% the value `true' if the verification passes. Upon failure, the function returns `false'. %% @end -spec auth_verify(Authenticator, Msg, Key) -> boolean() when @@ -1048,7 +1048,7 @@ shorthash(Msg, Key) -> %% @doc onetime_auth/2 produces a ONE-TIME authenticator for a message %% %% This function works like {@link auth/2} except that the key must not be used again for subsequent messages. That is, the pair -%% `{Msg, Key}' is unique and only to be used once. The advantage is noticably faster execution. +%% `{Msg, Key}' is unique and only to be used once. The advantage is noticeably faster execution. %% @end -spec onetime_auth(Msg, Key) -> Authenticator when @@ -1124,7 +1124,7 @@ curve25519_scalarmult_base(Secret) -> %% 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 key pair. %% %% Generates and returns a new key pair for the Ed 25519 signature scheme. The return value is a %% map in order to avoid using the public key as a secret key and vice versa. @@ -1170,7 +1170,7 @@ crypto_sign_ed25519_secret_size() -> %% Key exchange functions %% ---------------------- -%% @doc kx_keypair/0 creates a new Public/Secret keypair. +%% @doc kx_keypair/0 creates a new Public/Secret key pair. %% %% Generates and returns a new key pair for the key exchange. The return value is a %% map in order to avoid using the public key as a secret key and vice versa. diff --git a/src/enacl_ext.erl b/src/enacl_ext.erl index 7f203c2..b0304b4 100644 --- a/src/enacl_ext.erl +++ b/src/enacl_ext.erl @@ -33,7 +33,7 @@ scramble_block_16(Block, Key) -> %% Curve 25519 Crypto %% ------------------ -%% @doc curve25519_keypair/0 creates a new Public/Secret keypair. +%% @doc curve25519_keypair/0 creates a new Public/Secret key pair. %% %% Generates and returns a new key pair for the Curve 25519 encryption scheme. The return value is a %% map in order to avoid using the public key as a secret key and vice versa.