From d089f3683b16d86d38086c6ca68ac20bef304fd3 Mon Sep 17 00:00:00 2001 From: abderraouf-adjal Date: Wed, 19 Aug 2020 02:22:46 +0100 Subject: [PATCH] Minor code style mod --- src/SpritzCipher.c | 14 +++++++------- src/SpritzCipher.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/SpritzCipher.c b/src/SpritzCipher.c index cbad909..9e860bd 100644 --- a/src/SpritzCipher.c +++ b/src/SpritzCipher.c @@ -19,8 +19,8 @@ #include "SpritzCipher.h" /* Data types and constants */ -#define SPRITZ_N_MINUS_1 255 /* SPRITZ_N - 1 */ -#define SPRITZ_N_HALF 128 /* SPRITZ_N / 2 */ +#define SPRITZ_N_MINUS_1 255U /* SPRITZ_N - 1 */ +#define SPRITZ_N_HALF 128U /* SPRITZ_N / 2 */ static inline void @@ -53,7 +53,7 @@ spritz_state_init(spritz_ctx *ctx) ctx->k = 0; ctx->z = 0; ctx->a = 0; - ctx->w = 1; + ctx->w = 1U; } static inline void @@ -77,7 +77,7 @@ whip(spritz_ctx *ctx) update(ctx); } - ctx->w = (uint8_t)(ctx->w + 2); + ctx->w = (uint8_t)(ctx->w + 2U); } #ifdef SPRITZ_TIMING_SAFE_CRUSH @@ -105,7 +105,7 @@ crush(spritz_ctx *ctx) ctx->s[j] = ctx->tmp2; /* ctx->s[j]=s_j */ } } -# else +# else /* SPRITZ_WIPE_TRACES_PARANOID */ uint8_t s_i, s_j; for (; i < SPRITZ_N_HALF; i++, j--) { s_i = ctx->s[i]; @@ -133,7 +133,7 @@ crush(spritz_ctx *ctx) } } } -#endif +#endif /* SPRITZ_TIMING_SAFE_CRUSH */ static inline void shuffle(spritz_ctx *ctx) @@ -421,7 +421,7 @@ spritz_random32_uniform(spritz_ctx *ctx, uint32_t upper_bound) { uint32_t r, min; - if (upper_bound < 2) + if (upper_bound < 2U) { return 0; } diff --git a/src/SpritzCipher.h b/src/SpritzCipher.h index db9e8cb..d467d31 100644 --- a/src/SpritzCipher.h +++ b/src/SpritzCipher.h @@ -79,7 +79,8 @@ extern "C" { #endif /** SPRITZ_N - * Present the value of N in this spritz implementation, DO NOT change SPRITZ_N value. + * Present the value of N in this spritz implementation, + * DO NOT change SPRITZ_N value. */ #define SPRITZ_N 256U