From: Loup Vaillant Date: Sat, 21 Apr 2018 18:31:22 +0000 (+0200) Subject: Removed "cannot fail" from the manual X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=d574d18a08ef3db4e639b8bacdcb8a413a1313ef;p=Monocypher.git Removed "cannot fail" from the manual This is C we're talking about. Functions that return void cannot fail only if they're used correctly. Incorrect inputs can still trigger undefined behaviour. In this sense, those functions _can_ fail. Returning void should be an obvious enough hint that the function requires no error handling. At least it is if you're familiar enough with C. (If one is not, one is not qualified to use a crypto library in an unsafe language.) An unqualified "cannot fail" give any more information than `void`, and may even mislead some users. Better stay on the safe side. --- diff --git a/doc/man/man3/crypto_argon2i.3monocypher b/doc/man/man3/crypto_argon2i.3monocypher index fb63c7a..073c757 100644 --- a/doc/man/man3/crypto_argon2i.3monocypher +++ b/doc/man/man3/crypto_argon2i.3monocypher @@ -182,7 +182,6 @@ Must be zero if there is no additional data. .El .Sh RETURN VALUES These functions return nothing. -They cannot fail. .Sh EXAMPLES This example shows how to hash a password with the recommended baseline parameters: diff --git a/doc/man/man3/crypto_blake2b.3monocypher b/doc/man/man3/crypto_blake2b.3monocypher index a224c38..7c0f4c9 100644 --- a/doc/man/man3/crypto_blake2b.3monocypher +++ b/doc/man/man3/crypto_blake2b.3monocypher @@ -155,7 +155,6 @@ specifies a 64-byte hash and no key. This is considered a good default. .Sh RETURN VALUES These functions return nothing. -They cannot fail. .Sh EXAMPLES Hashing a message all at once: .Bd -literal -offset indent diff --git a/doc/man/man3/crypto_chacha20_H.3monocypher b/doc/man/man3/crypto_chacha20_H.3monocypher index fcda0d7..b460261 100644 --- a/doc/man/man3/crypto_chacha20_H.3monocypher +++ b/doc/man/man3/crypto_chacha20_H.3monocypher @@ -39,7 +39,6 @@ X25519 shared secrets have enough entropy. .El .Sh RETURN VALUES This function returns nothing. -It cannot fail. .Sh EXAMPLES Simple hash: .Bd -literal -offset indent diff --git a/doc/man/man3/crypto_chacha20_encrypt.3monocypher b/doc/man/man3/crypto_chacha20_encrypt.3monocypher index eb811d5..e75d024 100644 --- a/doc/man/man3/crypto_chacha20_encrypt.3monocypher +++ b/doc/man/man3/crypto_chacha20_encrypt.3monocypher @@ -181,7 +181,6 @@ Be careful when using this not to accidentally reuse parts of the random stream as that would destroy confidentiality. .Sh RETURN VALUES These functions return nothing. -They cannot fail. .Sh EXAMPLES Simple encryption: .Bd -literal -offset indent diff --git a/doc/man/man3/crypto_key_exchange.3monocypher b/doc/man/man3/crypto_key_exchange.3monocypher index bbcbfe2..6a07240 100644 --- a/doc/man/man3/crypto_key_exchange.3monocypher +++ b/doc/man/man3/crypto_key_exchange.3monocypher @@ -58,7 +58,6 @@ process are not known to be trustworthy, check the return value. .Pp .Fn crypto_key_exchange_public_key returns nothing. -It cannot fail. .Sh EXAMPLES Generate a public key from a randomly generated secret key: .Bd -literal -offset indent diff --git a/doc/man/man3/crypto_lock.3monocypher b/doc/man/man3/crypto_lock.3monocypher index 325e5be..559fd56 100644 --- a/doc/man/man3/crypto_lock.3monocypher +++ b/doc/man/man3/crypto_lock.3monocypher @@ -161,7 +161,6 @@ An incremental interface is available; see and .Fn crypto_lock_aead return nothing. -They cannot fail. .Fn crypto_unlock and .Fn crypto_unlock_aead diff --git a/doc/man/man3/crypto_lock_init.3monocypher b/doc/man/man3/crypto_lock_init.3monocypher index e7a41f6..201594c 100644 --- a/doc/man/man3/crypto_lock_init.3monocypher +++ b/doc/man/man3/crypto_lock_init.3monocypher @@ -133,7 +133,6 @@ Verify the MAC with and .Fn crypto_lock_final return nothing. -They cannot fail. .Pp .Fn crypto_unlock_final returns 0 on success or -1 if the message was corrupted. diff --git a/doc/man/man3/crypto_poly1305.3monocypher b/doc/man/man3/crypto_poly1305.3monocypher index fccbd1a..8e85e5b 100644 --- a/doc/man/man3/crypto_poly1305.3monocypher +++ b/doc/man/man3/crypto_poly1305.3monocypher @@ -85,7 +85,6 @@ Once the message is entirely processed, yields the message authentication code. .Sh RETURN VALUES These functions return nothing. -They cannot fail. .Sh EXAMPLES To authenticate a message: .Bd -literal -offset indent diff --git a/doc/man/man3/crypto_sign.3monocypher b/doc/man/man3/crypto_sign.3monocypher index 8c2d02f..bc36cc0 100644 --- a/doc/man/man3/crypto_sign.3monocypher +++ b/doc/man/man3/crypto_sign.3monocypher @@ -94,7 +94,6 @@ An incremental interface is available; see and .Fn crypto_sign return nothing. -They cannot fail. .Pp .Fn crypto_check returns 0 for legitimate messages and -1 for forgeries. diff --git a/doc/man/man3/crypto_sign_init_first_pass.3monocypher b/doc/man/man3/crypto_sign_init_first_pass.3monocypher index 2687bde..6a8a7b1 100644 --- a/doc/man/man3/crypto_sign_init_first_pass.3monocypher +++ b/doc/man/man3/crypto_sign_init_first_pass.3monocypher @@ -112,7 +112,6 @@ Signature verification with and .Fn crypto_check_update return nothing. -They cannot fail. .Pp .Fn crypto_check_final returns 0 for legitimate messages and -1 for forgeries. diff --git a/doc/man/man3/crypto_wipe.3monocypher b/doc/man/man3/crypto_wipe.3monocypher index b8f12b0..6f215da 100644 --- a/doc/man/man3/crypto_wipe.3monocypher +++ b/doc/man/man3/crypto_wipe.3monocypher @@ -50,6 +50,5 @@ Refer to for instructions on how to lock down memory on common operating systems. .Sh RETURN VALUES This function returns nothing. -It cannot fail. .Sh SEE ALSO .Xr intro 3monocypher