checkpatch: warning - block_comment_style

Change-Id: Ib2c6b713dd74e8b24a9a4a636f8923ae21c7c25e
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
This commit is contained in:
Dan Kalowsky 2015-10-23 10:33:45 -07:00 committed by Anas Nashif
commit 486c382bfe
5 changed files with 48 additions and 24 deletions

View file

@ -93,9 +93,11 @@ int32_t tc_cbc_mode_decrypt(uint8_t *out, uint32_t outlen, const uint8_t *in,
return TC_FAIL; 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 * contiguous. This allows for a very efficient decryption algorithm
* that would not otherwise be possible. */ * that would not otherwise be possible.
*/
p = iv; p = iv;
for (n = m = 0; n < inlen; ++n) { for (n = m = 0; n < inlen; ++n) {
if ((n % TC_AES_BLOCK_SIZE) == 0) { if ((n % TC_AES_BLOCK_SIZE) == 0) {

View file

@ -63,11 +63,13 @@ int32_t tc_hmac_set_key(TCHmacState_t ctx,
struct tc_hmac_state_struct dummy_state; struct tc_hmac_state_struct dummy_state;
if (key_size <= TC_SHA256_BLOCK_SIZE) { 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, * certain timing attacks. Without these dummy calls,
* adversaries would be able to learn whether the key_size is * adversaries would be able to learn whether the key_size is
* greater than TC_SHA256_BLOCK_SIZE by measuring the time * 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_init(&dummy_state.hash_state);
(void)tc_sha256_update(&dummy_state.hash_state, (void)tc_sha256_update(&dummy_state.hash_state,
dummy_key, dummy_key,

View file

@ -34,29 +34,41 @@
#include <tinycrypt/hmac.h> #include <tinycrypt/hmac.h>
#include <tinycrypt/utils.h> #include <tinycrypt/utils.h>
/* 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; 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; 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; 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; 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 * 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; 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); 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) { 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 || if (additionallen == 0 ||
additionallen > MAX_ALEN) { additionallen > MAX_ALEN) {
return TC_FAIL; return TC_FAIL;

View file

@ -42,10 +42,12 @@ int32_t tc_sha256_init(TCSha256State_t s)
return TC_FAIL; 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 * 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 * 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)); _set((uint8_t *) s, 0x00, sizeof(*s));
s->iv[0] = 0x6a09e667; s->iv[0] = 0x6a09e667;
s->iv[1] = 0xbb67ae85; s->iv[1] = 0xbb67ae85;
@ -131,9 +133,11 @@ int32_t tc_sha256_final(uint8_t *digest, TCSha256State_t s)
return TC_SUCCESS; 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 * 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] = { static const uint32_t k256[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,

View file

@ -53,9 +53,11 @@ void _set(uint8_t *to, uint8_t val, uint32_t len)
(void)memset(to, val, 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 * ((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) uint8_t _double_byte(uint8_t a)
{ {
return (a & MASK_MOST_SIG_BIT) ? return (a & MASK_MOST_SIG_BIT) ?