-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfips.c
34 lines (27 loc) · 840 Bytes
/
fips.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
#include <stdio.h>
#include <openssl/evp.h>
#include <openssl/provider.h>
static int print_provider(OSSL_PROVIDER *prov, void *unused)
{
printf(" %s\n", OSSL_PROVIDER_get0_name(prov));
return 1;
}
static int count_provider(OSSL_PROVIDER *prov, void *cbdata)
{
int *num_p = (int *)cbdata;
(*num_p)++;
}
int main(int argc, char *argv[])
{
int status = EXIT_SUCCESS;
int fips_enabled = 0;
printf("Loaded providers:\n");
OSSL_PROVIDER_do_all(NULL, &print_provider, NULL);
/* Count providers */
int provider_num = 0;
OSSL_PROVIDER_do_all(NULL, &count_provider, (void*)&provider_num);
printf("Loaded provider number: %d\n", provider_num);
fips_enabled = EVP_default_properties_is_fips_enabled(NULL);
printf("FIPS enabled: %s\n", (fips_enabled) ? "yes" : "no");
return status;
}