-
Notifications
You must be signed in to change notification settings - Fork 430
Expand file tree
/
Copy pathcrapi.c
More file actions
66 lines (60 loc) · 1.76 KB
/
crapi.c
File metadata and controls
66 lines (60 loc) · 1.76 KB
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
63
64
65
66
/*
* Copyright 2010 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* "Daniel Kopecek" <[email protected]>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "crapi.h"
#if defined(HAVE_NSS3)
#include <nss.h>
int crapi_init (void *unused)
{
return (NSS_NoDB_Init (NULL) == SECSuccess ? 0 : -1);
}
#elif defined(HAVE_GCRYPT)
#include <gcrypt.h>
int crapi_init (void *unused)
{
#ifdef HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG
gcry_control(GCRYCTL_SET_ENFORCED_FIPS_FLAG, 0);
#endif
if (!gcry_check_version(GCRYPT_VERSION))
return(-1);
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
return(0);
}
#elif defined(HAVE_OPENSSL_CRYPTO)
#include <openssl/evp.h>
#include <openssl/opensslv.h>
int crapi_init (void *unused)
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
/* OpenSSL < 1.1.0 requires explicit digest algorithm registration. */
OpenSSL_add_all_digests();
#endif
return 0;
}
#else
int crapi_init (void *unused)
{
return (0);
}
#endif