Skip to content
Snippets Groups Projects
Unverified Commit 6c69e6f4 authored by Koen Zandberg's avatar Koen Zandberg Committed by GitHub
Browse files

Merge pull request #10347 from mtausig/fixstyle

crypto: Fix code style
parents 64afc748 068e263c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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;
/**
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment