-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.c
62 lines (53 loc) · 1.44 KB
/
test.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
62
#include <stdio.h>
#include <string.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include "public.h"
#include "evp_sm3.h"
#include "ech_sm2.h"
#include "ecs_sm2.h"
#include "ece_sm2.h"
static const char rnd_seed[] = "string to make the random number";
int main(int argc, char *argv[])
{
int ret;
if (1) { /* open mem debug */
CRYPTO_malloc_debug_init();
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
} else {
CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
}
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
ERR_load_crypto_strings();
RAND_seed(rnd_seed, sizeof rnd_seed);
ret = sm3_test(argc, argv);
if (!ret) {
DEBUG_MSG("sm3_test ........ OK\n");
} else {
DEBUG_MSG("sm3_test ........ ERROR\n");
}
ret = sm2_ecdh_test(argc, argv);
if (!ret) {
DEBUG_MSG("sm2_ecdh_test ........ OK\n");
} else {
DEBUG_MSG("sm2_ecdh_test ........ ERROR\n");
}
ret = sm2_ecdsa_test(argc, argv);
if (!ret) {
DEBUG_MSG("sm2_ecdsa_test ........ OK\n");
} else {
DEBUG_MSG("sm2_ecdsa_test ........ ERROR\n");
}
ret = sm2_ecies_test(argc, argv);
if (!ret) {
DEBUG_MSG("sm2_ecies_test ........ OK\n");
} else {
DEBUG_MSG("sm2_ecies_test ........ ERROR\n");
}
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
ERR_remove_state(0);
CRYPTO_mem_leaks_fp(stderr);
return 0;
}