diff --git a/sys/include/crypto/aes.h b/sys/include/crypto/aes.h index 0a1b9b820f726ebad749776ef008ce787d2cd06d..959321cac119207b33d83b4fd8ab5c6ffc6857a0 100644 --- a/sys/include/crypto/aes.h +++ b/sys/include/crypto/aes.h @@ -41,11 +41,11 @@ typedef uint8_t u8; /* This controls loop-unrolling in aes_core.c */ #undef FULL_UNROLL # define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \ - ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) + ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) # define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); \ - (ct)[1] = (u8)((st) >> 16); \ - (ct)[2] = (u8)((st) >> 8); \ - (ct)[3] = (u8)(st); } + (ct)[1] = (u8)((st) >> 16); \ + (ct)[2] = (u8)((st) >> 8); \ + (ct)[3] = (u8)(st); } #define AES_MAXNR 14 #define AES_BLOCK_SIZE 16 diff --git a/sys/include/crypto/chacha.h b/sys/include/crypto/chacha.h index 5e01aa6339613e9d754deccc97009ff9dfd29bd2..ca89cc79ff4a10aff155d229482794952e4a5910 100644 --- a/sys/include/crypto/chacha.h +++ b/sys/include/crypto/chacha.h @@ -45,10 +45,9 @@ extern "C" { * @brief A ChaCha cipher stream context. * @details Initialize with chacha_init(). */ -typedef struct -{ +typedef struct { uint32_t state[16]; /**< The current state of the stream. */ - uint8_t rounds; /**< Number of iterations. */ + uint8_t rounds; /**< Number of iterations. */ } chacha_ctx; /** diff --git a/sys/include/crypto/ciphers.h b/sys/include/crypto/ciphers.h index 5eb99a33d504d2312a1a0d65797d609b146d88c0..ea0ce1c0968a5302f93d19b9e961c50919a21352 100644 --- a/sys/include/crypto/ciphers.h +++ b/sys/include/crypto/ciphers.h @@ -53,7 +53,7 @@ extern "C" { #elif defined(CRYPTO_AES) #define CIPHER_MAX_CONTEXT_SIZE CIPHERS_MAX_KEY_SIZE #else - // 0 is not a possibility because 0-sized arrays are not allowed in ISO C +/* 0 is not a possibility because 0-sized arrays are not allowed in ISO C */ #define CIPHER_MAX_CONTEXT_SIZE 1 #endif @@ -87,15 +87,15 @@ typedef struct cipher_interface_st { uint8_t max_key_size; /** the init function */ - int (*init)(cipher_context_t* ctx, const uint8_t* key, uint8_t key_size); + int (*init)(cipher_context_t *ctx, const uint8_t *key, uint8_t key_size); /** the encrypt function */ - int (*encrypt)(const cipher_context_t* ctx, const uint8_t* plain_block, - uint8_t* cipher_block); + int (*encrypt)(const cipher_context_t *ctx, const uint8_t *plain_block, + uint8_t *cipher_block); /** the decrypt function */ - int (*decrypt)(const cipher_context_t* ctx, const uint8_t* cipher_block, - uint8_t* plain_block); + int (*decrypt)(const cipher_context_t *ctx, const uint8_t *cipher_block, + uint8_t *plain_block); } cipher_interface_t; @@ -109,10 +109,10 @@ extern const cipher_id_t CIPHER_AES_128; * contains the cipher interface and the context */ typedef struct { - const cipher_interface_t* interface; /**< BlockCipher-Interface for the - Cipher-Algorithms */ - cipher_context_t context; /**< The encryption context (buffer) - for the algorithm */ + const cipher_interface_t *interface; /**< BlockCipher-Interface for the + Cipher-Algorithms */ + cipher_context_t context; /**< The encryption context (buffer) + for the algorithm */ } cipher_t; @@ -128,7 +128,7 @@ typedef struct { * The command may be unsuccessful if the key size is not valid. * CIPHER_ERR_BAD_CONTEXT_SIZE if CIPHER_MAX_CONTEXT_SIZE has not been defined (which means that the cipher has not been included in the build) */ -int cipher_init(cipher_t* cipher, cipher_id_t cipher_id, const uint8_t* key, +int cipher_init(cipher_t *cipher, cipher_id_t cipher_id, const uint8_t *key, uint8_t key_size); @@ -141,7 +141,7 @@ int cipher_init(cipher_t* cipher, cipher_id_t cipher_id, const uint8_t* key, * @param output pointer to allocated memory for encrypted data. It has to * be of size BLOCK_SIZE */ -int cipher_encrypt(const cipher_t* cipher, const uint8_t* input, uint8_t* output); +int cipher_encrypt(const cipher_t *cipher, const uint8_t *input, uint8_t *output); /** @@ -153,7 +153,7 @@ int cipher_encrypt(const cipher_t* cipher, const uint8_t* input, uint8_t* output * @param output pointer to allocated memory for decrypted data. It has to * be of size BLOCK_SIZE */ -int cipher_decrypt(const cipher_t* cipher, const uint8_t* input, uint8_t* output); +int cipher_decrypt(const cipher_t *cipher, const uint8_t *input, uint8_t *output); /** @@ -162,7 +162,7 @@ int cipher_decrypt(const cipher_t* cipher, const uint8_t* input, uint8_t* output * * @param cipher Already initialized cipher struct */ -int cipher_get_block_size(const cipher_t* cipher); +int cipher_get_block_size(const cipher_t *cipher); #ifdef __cplusplus