Esempio n. 1
0
/*
 * Main task to test CTR PRNG
 */
int main(void)
{
	int elements;
	int rc;
	int i;

	TC_START("Performing CTR-PRNG tests:");

	elements = (int)sizeof(vectors) / sizeof(vectors[0]);
	for (i = 0; i < elements; i++) {
		rc = test_prng_vector(&vectors[i]);
		TC_PRINT("[%s] test_prng_vector #%d\n", RC_STR(rc), i);
		if (rc != TC_PASS) {
			goto exit_test;
		}
	}

	rc = test_reseed();
	TC_PRINT("[%s] test_reseed\n", RC_STR(rc));
	if (rc != TC_PASS) {
		goto exit_test;
	}

	rc = test_uninstantiate();
	TC_PRINT("[%s] test_uninstantiate\n", RC_STR(rc));
	if (rc != TC_PASS) {
		goto exit_test;
	}

	rc = test_robustness();
	TC_PRINT("[%s] test_robustness\n", RC_STR(rc));
	if (rc != TC_PASS) {
		goto exit_test;
	}

	TC_PRINT("\nAll CTR PRNG tests succeeded!\n");
	rc = TC_PASS;

exit_test:
	TC_END_RESULT(rc);
	TC_END_REPORT(rc);

	return 0;
}
Esempio n. 2
0
/*
 * Main task to test CTR PRNG
 */
int main(void)
{
	int32_t result = TC_PASS;
	uint32_t i;
	TC_START("Performing CTR-PRNG tests:");
	for (i = 0U; i < sizeof vectors / sizeof vectors[0]; i++)
	{
		result = executePRNG_TestVector(vectors[i], i);
		if (TC_PASS != result)
		{
			goto exitTest;
		}
	}

	if (TC_PASS != test_reseed())
	{
		goto exitTest;
	}

	if (TC_PASS != test_uninstantiate())
	{
		goto exitTest;
	}

	if (TC_PASS != test_robustness())
	{
		goto exitTest;
	}

	TC_PRINT("All CTR PRNG tests succeeded!\n");

	exitTest:
    	TC_END_RESULT(result);
    	TC_END_REPORT(result);

}