From: Loup Vaillant Date: Sun, 23 Sep 2018 16:24:03 +0000 (+0200) Subject: Manual: wrong nonce size in examples X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=a2386d328706fcc3bc76c4a6065af6d151218bb7;p=Monocypher.git Manual: wrong nonce size in examples --- diff --git a/doc/man/man3/crypto_lock_init.3monocypher b/doc/man/man3/crypto_lock_init.3monocypher index 201594c..8f0aa4c 100644 --- a/doc/man/man3/crypto_lock_init.3monocypher +++ b/doc/man/man3/crypto_lock_init.3monocypher @@ -143,7 +143,7 @@ attacker's interference. Encryption: .Bd -literal -offset indent const uint8_t key [ 32]; /* Session key */ -const uint8_t nonce [ 32]; /* Unique per session key */ +const uint8_t nonce [ 24]; /* Unique per session key */ const uint8_t ad [500]; /* Optional additional data */ const uint8_t plain_text [500]; /* Secret message */ uint8_t cipher_text[500]; /* Encrypted message */ @@ -174,7 +174,7 @@ crypto_lock_final(&ctx, mac); To decrypt the above: .Bd -literal -offset indent const uint8_t key [ 32]; /* Session key */ -const uint8_t nonce [ 32]; /* Unique per session key */ +const uint8_t nonce [ 24]; /* Unique per session key */ const uint8_t mac [ 16]; /* Transmitted MAC */ const uint8_t ad [500]; /* Optional additional data */ const uint8_t cipher_text[500]; /* Encrypted message */ @@ -210,7 +210,7 @@ crypto_wipe(plain_text, 500); To authenticate the above without decrypting it: .Bd -literal -offset indent const uint8_t key [ 32]; /* Session key */ -const uint8_t nonce [ 32]; /* Unique per session key */ +const uint8_t nonce [ 24]; /* Unique per session key */ const uint8_t mac [ 16]; /* Transmitted MAC */ const uint8_t ad [500]; /* Optional additional data */ const uint8_t cipher_text[500]; /* Encrypted message */ @@ -242,7 +242,7 @@ if (crypto_unlock_final(&ctx, mac)) { In-place encryption without additional data: .Bd -literal -offset indent const uint8_t key [ 32]; /* Session key */ -const uint8_t nonce [ 32]; /* Unique per session key */ +const uint8_t nonce [ 24]; /* Unique per session key */ uint8_t text [500]; /* Message */ uint8_t mac [ 16]; /* Message authentication code */