| 1 | /* |
| 2 | * Copyright 2010 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * "Daniel Kopecek" <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #ifdef HAVE_CONFIG_H |
| 24 | #include <config.h> |
| 25 | #endif |
| 26 | |
| 27 | #include "crapi.h" |
| 28 | |
| 29 | #if defined(HAVE_NSS3) |
| 30 | #include <nss.h> |
| 31 | |
| 32 | int crapi_init (void *unused) |
| 33 | { |
| 34 | return (NSS_NoDB_Init (NULL) == SECSuccess ? 0 : -1); |
| 35 | } |
| 36 | #elif defined(HAVE_GCRYPT) |
| 37 | #include <gcrypt.h> |
| 38 | int crapi_init (void *unused) |
| 39 | { |
| 40 | #ifdef HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG |
| 41 | gcry_control(GCRYCTL_SET_ENFORCED_FIPS_FLAG, 0); |
| 42 | #endif |
| 43 | if (!gcry_check_version(GCRYPT_VERSION)) |
| 44 | return(-1); |
| 45 | |
| 46 | gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); |
| 47 | |
| 48 | return(0); |
| 49 | } |
| 50 | #else |
| 51 | int crapi_init (void *unused) |
| 52 | { |
| 53 | return (0); |
| 54 | } |
| 55 | #endif |