-
Notifications
You must be signed in to change notification settings - Fork 7
/
test_demo.c
61 lines (54 loc) · 2.12 KB
/
test_demo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**************************************************
* File name: test_demo.c
* Author: HAN Wei
* Author's blog: https://blog.csdn.net/henter/
* Date: Feb 10th, 2019
* Description: implement hash DRBG test demo programs
**************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "test_hash_drbg.h"
int main(void)
{
int error_code;
printf("\n*******************************************\n");
printf("Test SHA-256 Hash DRBG without prediction resistance:\n");
if ( error_code = test_sha256_hash_drbg_without_prediction_resistance() )
{
printf("Generating random bytes test failed!\n");
printf("Error code: 0x%x", error_code);
return error_code;
}
printf("Generating random bytes test succeeded!\n");
printf("\n*******************************************\n");
printf("Test SHA-256 Hash DRBG with prediction resistance:\n");
if ( error_code = test_sha256_hash_drbg_with_prediction_resistance() )
{
printf("Generating random bytes test failed!\n");
printf("Error code: 0x%x", error_code);
return error_code;
}
printf("Generating random bytes test succeeded!\n");
printf("\n*******************************************\n");
printf("Test SHA-512 Hash DRBG without prediction resistance:\n");
if ( error_code = test_sha512_hash_drbg_without_prediction_resistance() )
{
printf("Generating random bytes test failed!\n");
printf("Error code: 0x%x", error_code);
return error_code;
}
printf("Generating random bytes test succeeded!\n");
printf("\n*******************************************\n");
printf("Test SHA-512 Hash DRBG with prediction resistance:\n");
if ( error_code = test_sha512_hash_drbg_with_prediction_resistance() )
{
printf("Generating random bytes test failed!\n");
printf("Error code: 0x%x", error_code);
return error_code;
}
printf("Generating random bytes test succeeded!\n");
#if defined(_WIN32) || defined(_WIN64)
system("pause");
#endif
return 0;
}