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:
parent
9c2c57b730
commit
9c426ba3f8
1 changed files with 19 additions and 20 deletions
|
@ -31,13 +31,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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>
|
||||||
|
@ -53,12 +53,18 @@
|
||||||
|
|
||||||
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");
|
||||||
|
@ -68,12 +74,6 @@ void main(void)
|
||||||
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");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue