.It
Initialisation with
.Fn crypto_lock_init .
-This sets up a context for encryption or decryption (the same function
-is used for both).
+This sets up a context for encryption or decryption.
+The same function is used for both.
.It
Authentication with
.Fn crypto_lock_auth .
This authenticates (or verifies) additional data, if any.
-This step is optional.
.It
Update, with
.Fn crypto_lock_update
Used with
.Fn crypto_lock_auth ,
it enables various AEAD constructions.
-Most users don't need it.
+Most users do not need it.
Prefer
.Fn crypto_lock_update
and
function returns 0 on success or -1 if the message was corrupted.
Corruption can happen because of transmission errors, programmer
error, or attacker interference.
-.Em Always check the return value.
+.Em Always check the return value .
.Sh EXAMPLES
Encryption:
.Bd -literal -offset indent
}
.Ed
.Pp
-In place Encryption (without additional data for clarity):
+In-place Encryption (without additional data for clarity):
.Bd -literal -offset indent
const uint8_t key [ 32]; /* session key */
const uint8_t nonce [ 32]; /* unique per session key */
.Sh SYNOPSIS
.In monocypher.h
.Ft void
-.Ft void
.Fo crypto_sign_public_key
.Fa "uint8_t public_key[32]"
.Fa "const uint8_t secret_key[32]"
.Fc
+.Ft void
.Fo crypto_sign
.Fa "uint8_t signature[64]"
.Fa "const uint8_t secret_key[32]"
.Xr crypto_key_exchange 3monocypher .
Do not use the same private key for both purposes.
.Pp
-The
.Fn crypto_sign
-function signs a message with
+signs a message with
.Fa secret_key .
The public key is optional, and will be recomputed if not provided.
-This doubles execution time.
+This recomputation doubles the execution time.
.Pp
-The
.Fn crypto_check
-function checks that a given signature is genuine.
+checks that a given signature is genuine.
Meaning, only someone who had the private key could have signed the
message.
.Pp
-It does
+.Fn crypto_check
+does
.Em not
run in constant time.
It does not have to in most threat models, because nothing is secret:
.Xr crypto_lock 3monocypher ,
.Xr intro 3monocypher
.Sh STANDARDS
-These functions implement EdDSA with curve25519 and Blake2b.
+These functions implement EdDSA with Curve25519 and Blake2b.
This is the same as Ed25519, with Blake2b instead of SHA-512.
Ed25519 is described in RFC 7748.
.Sh SECURITY CONSIDERATIONS
If attackers are expected to have such access and the relevant
equipment, use
.Fn crypto_check
-to verify the signature.
+to verify the signature before sending it away.
This verification reduces the speed of the whole operation by a factor
of 3, and only provides an incomplete protection.