-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfips_set.c
49 lines (39 loc) · 1.24 KB
/
fips_set.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
#include <stdio.h>
#include <openssl/evp.h>
int main(int argc, char *argv[])
{
int status = EXIT_SUCCESS;
int fips_enabled = 0;
fips_enabled = EVP_default_properties_is_fips_enabled(NULL);
printf("FIPS: %d\n", fips_enabled);
printf("FIPS on.\n");
if (!EVP_default_properties_enable_fips(NULL, 1)) {
status = EXIT_FAILURE;
goto err;
}
fips_enabled = EVP_default_properties_is_fips_enabled(NULL);
printf("FIPS: %d\n", fips_enabled);
printf("FIPS on 2nd time.\n");
if (!EVP_default_properties_enable_fips(NULL, 1)) {
status = EXIT_FAILURE;
goto err;
}
fips_enabled = EVP_default_properties_is_fips_enabled(NULL);
printf("FIPS: %d\n", fips_enabled);
printf("FIPS off.\n");
if (!EVP_default_properties_enable_fips(NULL, 0)) {
status = EXIT_FAILURE;
goto err;
}
fips_enabled = EVP_default_properties_is_fips_enabled(NULL);
printf("FIPS: %d\n", fips_enabled);
printf("FIPS off 2nd time.\n");
if (!EVP_default_properties_enable_fips(NULL, 0)) {
status = EXIT_FAILURE;
goto err;
}
fips_enabled = EVP_default_properties_is_fips_enabled(NULL);
printf("FIPS: %d\n", fips_enabled);
err:
return status;
}