test/tinycrypt: Solve style issues in test_hmac_prng

Style issues fixed by this commit:

- Comments
- Variable declaration/definition
- Space between cast

Change-Id: Ia6eb7718c55b976cd0899ede742d89483db191b3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
Flavio Santes 2016-11-16 13:20:05 -06:00 committed by Anas Nashif
commit 9c426ba3f8

View file

@ -31,14 +31,14 @@
*/ */
/* /*
DESCRIPTION * DESCRIPTION
This module tests the following PRNG routines: * This module tests the following PRNG routines:
*
Scenarios tested include: * Scenarios tested include:
- HMAC-PRNG init * - HMAC-PRNG init
- HMAC-PRNG reseed * - HMAC-PRNG reseed
- HMAC-PRNG generate) * - HMAC-PRNG generate)
*/ */
#include <tinycrypt/hmac_prng.h> #include <tinycrypt/hmac_prng.h>
#include <tinycrypt/constants.h> #include <tinycrypt/constants.h>
@ -53,27 +53,27 @@
void main(void) void main(void)
{ {
uint8_t seed[128]; /* Fake personalization and additional_input
struct tc_hmac_prng_struct h; * (replace by appropriate values)
* e.g.: hostname+timestamp
*/
uint8_t additional_input[] = "additional input";
uint8_t personalization[] = "HOSTNAME";
uint32_t size = (1 << 15); uint32_t size = (1 << 15);
uint8_t random[size];
uint32_t i;
uint32_t result = TC_PASS; uint32_t result = TC_PASS;
struct tc_hmac_prng_struct h;
uint8_t random[size];
uint8_t seed[128];
uint32_t i;
TC_START("Performing HMAC-PRNG tests:"); TC_START("Performing HMAC-PRNG tests:");
TC_PRINT("HMAC-PRNG test#1 (init, reseed, generate):\n"); TC_PRINT("HMAC-PRNG test#1 (init, reseed, generate):\n");
/* Fake seed (replace by a a truly random seed): */ /* Fake seed (replace by a a truly random seed): */
for (i = 0; i < (uint32_t) sizeof(seed); ++i) { for (i = 0; i < (uint32_t)sizeof(seed); ++i) {
seed[i] = i; seed[i] = i;
} }
/* Fake personalization and additional_input (replace by appropriate
* values): */
/* e.g.: hostname+timestamp */
uint8_t personalization[] = "HOSTNAME";
uint8_t additional_input[] = "additional input";
TC_PRINT("HMAC-PRNG test#1 (init):\n"); TC_PRINT("HMAC-PRNG test#1 (init):\n");
if (tc_hmac_prng_init(&h, personalization, if (tc_hmac_prng_init(&h, personalization,
sizeof(personalization)) == 0) { sizeof(personalization)) == 0) {
@ -90,7 +90,6 @@ void main(void)
result = TC_FAIL; result = TC_FAIL;
goto exitTest; goto exitTest;
} }
TC_END_RESULT(result); TC_END_RESULT(result);
TC_PRINT("HMAC-PRNG test#1 (generate):\n"); TC_PRINT("HMAC-PRNG test#1 (generate):\n");