From bc3f49a7d083959154d72e2a70a643593de0950c Mon Sep 17 00:00:00 2001 From: Mathias Tausig Date: Tue, 4 Oct 2016 09:30:22 +0200 Subject: [PATCH] ciphers: Documented return values of init functions --- sys/include/crypto/3des.h | 4 ++-- sys/include/crypto/aes.h | 4 ++-- sys/include/crypto/ciphers.h | 3 +++ sys/include/crypto/twofish.h | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/include/crypto/3des.h b/sys/include/crypto/3des.h index fecac32a23..421babeab1 100644 --- a/sys/include/crypto/3des.h +++ b/sys/include/crypto/3des.h @@ -85,8 +85,8 @@ static const uint32_t bigbyte[24] = { * @param keySize the size of the key * - * @return Whether initialization was successful. The command may be - * unsuccessful if the key size is not valid. + * @return 1 if the initialization was successful or 0 in case of an error. + * The command may be unsuccessful if the key size is not valid. */ int tripledes_init(cipher_context_t *context, const uint8_t* key, uint8_t keySize); diff --git a/sys/include/crypto/aes.h b/sys/include/crypto/aes.h index f38132332d..e2c7c6b1b2 100644 --- a/sys/include/crypto/aes.h +++ b/sys/include/crypto/aes.h @@ -80,8 +80,8 @@ typedef struct { * @param keySize the size of the key * @param key a pointer to the key * - * @return Whether initialization was successful. The command may be - * unsuccessful if the key size is not valid. + * @return 1 if the initialization was successful or 0 in case of an error. + * The command may be unsuccessful if the key size is not valid. */ int aes_init(cipher_context_t *context, const uint8_t *key, uint8_t keySize); diff --git a/sys/include/crypto/ciphers.h b/sys/include/crypto/ciphers.h index fcada82b40..aed2ee0040 100644 --- a/sys/include/crypto/ciphers.h +++ b/sys/include/crypto/ciphers.h @@ -126,6 +126,9 @@ typedef struct { * @param cipher_id cipher algorithm id * @param key encryption key to use * @param key_size length of the encryption key + * + * @return 1 if the initialization was successful or 0 in case of an error. + * The command may be unsuccessful if the key size is not valid. */ int cipher_init(cipher_t* cipher, cipher_id_t cipher_id, const uint8_t* key, uint8_t key_size); diff --git a/sys/include/crypto/twofish.h b/sys/include/crypto/twofish.h index 0ad6976ce6..5eba56f988 100644 --- a/sys/include/crypto/twofish.h +++ b/sys/include/crypto/twofish.h @@ -222,8 +222,8 @@ typedef struct { * @param key_size key size in bytes * @param key pointer to the key * - * @return Whether initialization was successful. The command may be - * unsuccessful if the key size is not valid. + * @return 1 if the initialization was successful or 0 in case of an error. + * The command may be unsuccessful if the key size is not valid. */ int twofish_init(cipher_context_t *context, const uint8_t *key, uint8_t key_size);