From 486c382bfe42fef4b60d46b9b0812651834f70f5 Mon Sep 17 00:00:00 2001 From: Dan Kalowsky Date: Fri, 23 Oct 2015 10:33:45 -0700 Subject: [PATCH] checkpatch: warning - block_comment_style Change-Id: Ib2c6b713dd74e8b24a9a4a636f8923ae21c7c25e Signed-off-by: Dan Kalowsky --- lib/crypto/tinycrypt/source/cbc_mode.c | 6 ++-- lib/crypto/tinycrypt/source/hmac.c | 6 ++-- lib/crypto/tinycrypt/source/hmac_prng.c | 42 ++++++++++++++++--------- lib/crypto/tinycrypt/source/sha256.c | 12 ++++--- lib/crypto/tinycrypt/source/utils.c | 6 ++-- 5 files changed, 48 insertions(+), 24 deletions(-) diff --git a/lib/crypto/tinycrypt/source/cbc_mode.c b/lib/crypto/tinycrypt/source/cbc_mode.c index 8b27a9c1d22..eb87b53f658 100644 --- a/lib/crypto/tinycrypt/source/cbc_mode.c +++ b/lib/crypto/tinycrypt/source/cbc_mode.c @@ -93,9 +93,11 @@ int32_t tc_cbc_mode_decrypt(uint8_t *out, uint32_t outlen, const uint8_t *in, return TC_FAIL; } - /* Note that in == iv + ciphertext, i.e. the iv and the ciphertext are + /* + * Note that in == iv + ciphertext, i.e. the iv and the ciphertext are * contiguous. This allows for a very efficient decryption algorithm - * that would not otherwise be possible. */ + * that would not otherwise be possible. + */ p = iv; for (n = m = 0; n < inlen; ++n) { if ((n % TC_AES_BLOCK_SIZE) == 0) { diff --git a/lib/crypto/tinycrypt/source/hmac.c b/lib/crypto/tinycrypt/source/hmac.c index 489e10539e2..7c3b10690f1 100644 --- a/lib/crypto/tinycrypt/source/hmac.c +++ b/lib/crypto/tinycrypt/source/hmac.c @@ -63,11 +63,13 @@ int32_t tc_hmac_set_key(TCHmacState_t ctx, struct tc_hmac_state_struct dummy_state; if (key_size <= TC_SHA256_BLOCK_SIZE) { - /* The next three lines consist of dummy calls just to avoid + /* + * The next three lines consist of dummy calls just to avoid * certain timing attacks. Without these dummy calls, * adversaries would be able to learn whether the key_size is * greater than TC_SHA256_BLOCK_SIZE by measuring the time - * consumed in this process.*/ + * consumed in this process. + */ (void)tc_sha256_init(&dummy_state.hash_state); (void)tc_sha256_update(&dummy_state.hash_state, dummy_key, diff --git a/lib/crypto/tinycrypt/source/hmac_prng.c b/lib/crypto/tinycrypt/source/hmac_prng.c index f37b9965836..4ee6cf4ab93 100644 --- a/lib/crypto/tinycrypt/source/hmac_prng.c +++ b/lib/crypto/tinycrypt/source/hmac_prng.c @@ -34,29 +34,41 @@ #include #include -/* min bytes in the seed string. - * MIN_SLEN*8 must be at least the expected security level. */ +/* + * min bytes in the seed string. + * MIN_SLEN*8 must be at least the expected security level. + */ static const uint32_t MIN_SLEN = 32; -/* max bytes in the seed string; - * SP800-90A specifies a maximum of 2^35 bits (i.e., 2^32 bytes).*/ +/* + * max bytes in the seed string; + * SP800-90A specifies a maximum of 2^35 bits (i.e., 2^32 bytes). + */ static const uint32_t MAX_SLEN = UINT32_MAX; -/* max bytes in the personalization string; - * SP800-90A specifies a maximum of 2^35 bits (i.e., 2^32 bytes).*/ +/* + * max bytes in the personalization string; + * SP800-90A specifies a maximum of 2^35 bits (i.e., 2^32 bytes). + */ static const uint32_t MAX_PLEN = UINT32_MAX; -/* max bytes in the additional_info string; - * SP800-90A specifies a maximum of 2^35 bits (i.e., 2^32 bytes).*/ +/* + * max bytes in the additional_info string; + * SP800-90A specifies a maximum of 2^35 bits (i.e., 2^32 bytes). + */ static const uint32_t MAX_ALEN = UINT32_MAX; -/* max number of generates between re-seeds; +/* + * max number of generates between re-seeds; * TinyCrypt accepts up to (2^32 - 1) which is the maximal value of - * a uint32_t variable, while SP800-90A specifies a maximum of 2^48.*/ + * a uint32_t variable, while SP800-90A specifies a maximum of 2^48. + */ static const uint32_t MAX_GENS = UINT32_MAX; -/* maximum bytes per generate call; - * SP800-90A specifies a maximum up to 2^19.*/ +/* + * maximum bytes per generate call; + * SP800-90A specifies a maximum up to 2^19. + */ static const uint32_t MAX_OUT = (1 << 19); /* @@ -136,8 +148,10 @@ int32_t tc_hmac_prng_reseed(TCHmacPrng_t prng, } if (additional_input != (const uint8_t *) 0) { - /* Abort if additional_input is provided but has inappropriate - * length */ + /* + * Abort if additional_input is provided but has inappropriate + * length + */ if (additionallen == 0 || additionallen > MAX_ALEN) { return TC_FAIL; diff --git a/lib/crypto/tinycrypt/source/sha256.c b/lib/crypto/tinycrypt/source/sha256.c index c459f74fc07..889a65920ea 100644 --- a/lib/crypto/tinycrypt/source/sha256.c +++ b/lib/crypto/tinycrypt/source/sha256.c @@ -42,10 +42,12 @@ int32_t tc_sha256_init(TCSha256State_t s) return TC_FAIL; } - /* Setting the initial state values. + /* + * Setting the initial state values. * These values correspond to the first 32 bits of the fractional parts * of the square roots of the first 8 primes: 2, 3, 5, 7, 11, 13, 17 - * and 19. */ + * and 19. + */ _set((uint8_t *) s, 0x00, sizeof(*s)); s->iv[0] = 0x6a09e667; s->iv[1] = 0xbb67ae85; @@ -131,9 +133,11 @@ int32_t tc_sha256_final(uint8_t *digest, TCSha256State_t s) return TC_SUCCESS; } -/* Initializing SHA-256 Hash constant words K. +/* + * Initializing SHA-256 Hash constant words K. * These values correspond to the first 32 bits of the fractional parts of the - * cube roots of the first 64 primes between 2 and 311. */ + * cube roots of the first 64 primes between 2 and 311. + */ static const uint32_t k256[64] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, diff --git a/lib/crypto/tinycrypt/source/utils.c b/lib/crypto/tinycrypt/source/utils.c index f0fc6e4b76d..854670fffc5 100644 --- a/lib/crypto/tinycrypt/source/utils.c +++ b/lib/crypto/tinycrypt/source/utils.c @@ -53,9 +53,11 @@ void _set(uint8_t *to, uint8_t val, uint32_t len) (void)memset(to, val, len); } -/* Doubles the value of a byte for values up to 127. Original 'return +/* + * Doubles the value of a byte for values up to 127. Original 'return * ((a<<1) ^ ((a>>7) * 0x1b))' re-written to avoid extra multiplicaiton which - * the compiler won't be able to optimize */ + * the compiler won't be able to optimize + */ uint8_t _double_byte(uint8_t a) { return (a & MASK_MOST_SIG_BIT) ?