diff options
author | Daiki Ueno <ueno@gnu.org> | 2023-04-24 12:39:42 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2023-04-24 12:45:46 +0900 |
commit | aa5950abab56b011331ad4331409b6ff8efb8aeb (patch) | |
tree | ad363fb38e8b65c942876641cda9c76caa13b498 /lib/nettle/int/drbg-aes.h | |
parent | 0fe9cb6842d63761718046cc7dd7eb437e6c5163 (diff) | |
download | gnutls-aa5950abab56b011331ad4331409b6ff8efb8aeb.tar.gz |
build: re-indent code
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/nettle/int/drbg-aes.h')
-rw-r--r-- | lib/nettle/int/drbg-aes.h | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/lib/nettle/int/drbg-aes.h b/lib/nettle/int/drbg-aes.h index f147706523..845a89db6c 100644 --- a/lib/nettle/int/drbg-aes.h +++ b/lib/nettle/int/drbg-aes.h @@ -20,24 +20,23 @@ */ #ifndef GNUTLS_LIB_NETTLE_INT_DRBG_AES_H -# define GNUTLS_LIB_NETTLE_INT_DRBG_AES_H +#define GNUTLS_LIB_NETTLE_INT_DRBG_AES_H -# include <config.h> -# include <nettle/aes.h> +#include <config.h> +#include <nettle/aes.h> /* This is nettle's increment macro */ /* Requires that size > 0 */ -# define INCREMENT(size, ctr) \ - do { \ - unsigned increment_i = (size) - 1; \ - if (++(ctr)[increment_i] == 0) \ - while (increment_i > 0 \ - && ++(ctr)[--increment_i] == 0 ) \ - ; \ - } while (0) - -# define DRBG_AES_KEY_SIZE AES256_KEY_SIZE -# define DRBG_AES_SEED_SIZE (AES_BLOCK_SIZE+DRBG_AES_KEY_SIZE) +#define INCREMENT(size, ctr) \ + do { \ + unsigned increment_i = (size)-1; \ + if (++(ctr)[increment_i] == 0) \ + while (increment_i > 0 && ++(ctr)[--increment_i] == 0) \ + ; \ + } while (0) + +#define DRBG_AES_KEY_SIZE AES256_KEY_SIZE +#define DRBG_AES_SEED_SIZE (AES_BLOCK_SIZE + DRBG_AES_KEY_SIZE) /* This is the CTR-AES-256-based random-number generator from SP800-90A. */ @@ -52,33 +51,30 @@ struct drbg_aes_ctx { }; /* max_number_of_bits_per_request */ -# define MAX_DRBG_AES_GENERATE_SIZE 65536 /* 2^19 */ +#define MAX_DRBG_AES_GENERATE_SIZE 65536 /* 2^19 */ /* This DRBG should be reseeded if reseed_counter exceeds * that number. Otherwise drbg_aes_random() will fail. */ -# define DRBG_AES_RESEED_TIME 16777216 +#define DRBG_AES_RESEED_TIME 16777216 /* The entropy provided in these functions should be of * size DRBG_AES_SEED_SIZE. Additional data and pers. * string may be <= DRBG_AES_SEED_SIZE. */ -int -drbg_aes_init(struct drbg_aes_ctx *ctx, - unsigned entropy_size, const uint8_t * entropy, - unsigned pstring_size, const uint8_t * pstring); +int drbg_aes_init(struct drbg_aes_ctx *ctx, unsigned entropy_size, + const uint8_t *entropy, unsigned pstring_size, + const uint8_t *pstring); -int -drbg_aes_reseed(struct drbg_aes_ctx *ctx, - unsigned entropy_size, const uint8_t * entropy, - unsigned add_size, const uint8_t * add); +int drbg_aes_reseed(struct drbg_aes_ctx *ctx, unsigned entropy_size, + const uint8_t *entropy, unsigned add_size, + const uint8_t *add); /* our wrapper for the low-level drbg_aes_generate */ -int drbg_aes_random(struct drbg_aes_ctx *ctx, unsigned length, uint8_t * dst); +int drbg_aes_random(struct drbg_aes_ctx *ctx, unsigned length, uint8_t *dst); -int -drbg_aes_generate(struct drbg_aes_ctx *ctx, unsigned length, - uint8_t * dst, unsigned add_size, const uint8_t * add); +int drbg_aes_generate(struct drbg_aes_ctx *ctx, unsigned length, uint8_t *dst, + unsigned add_size, const uint8_t *add); /* For deinitialization use zeroize_key() on the context */ @@ -86,4 +82,4 @@ int drbg_aes_is_seeded(struct drbg_aes_ctx *ctx); int drbg_aes_self_test(void); -#endif /* GNUTLS_LIB_NETTLE_INT_DRBG_AES_H */ +#endif /* GNUTLS_LIB_NETTLE_INT_DRBG_AES_H */ |