|
Packit |
549fdc |
/*
|
|
Packit |
549fdc |
* Copyright (C) 2010-2016 Free Software Foundation, Inc.
|
|
Packit |
549fdc |
* Copyright (C) 2015-2016 Red Hat, Inc.
|
|
Packit |
549fdc |
*
|
|
Packit |
549fdc |
* Author: Nikos Mavrogiannopoulos
|
|
Packit |
549fdc |
*
|
|
Packit |
549fdc |
* This file is part of GnuTLS.
|
|
Packit |
549fdc |
*
|
|
Packit |
549fdc |
* The GnuTLS is free software; you can redistribute it and/or
|
|
Packit |
549fdc |
* modify it under the terms of the GNU Lesser General Public License
|
|
Packit |
549fdc |
* as published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
549fdc |
* the License, or (at your option) any later version.
|
|
Packit |
549fdc |
*
|
|
Packit |
549fdc |
* This library is distributed in the hope that it will be useful, but
|
|
Packit |
549fdc |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
549fdc |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
549fdc |
* Lesser General Public License for more details.
|
|
Packit |
549fdc |
*
|
|
Packit |
549fdc |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
549fdc |
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
Packit |
549fdc |
*
|
|
Packit |
549fdc |
*/
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
#include <config.h>
|
|
Packit |
549fdc |
#include <system.h>
|
|
Packit |
549fdc |
#include "gnutls_int.h"
|
|
Packit |
549fdc |
#include "errors.h"
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
#include <sys/socket.h>
|
|
Packit |
549fdc |
#include <errno.h>
|
|
Packit |
549fdc |
#include <sys/stat.h>
|
|
Packit |
549fdc |
#include <sys/types.h>
|
|
Packit |
549fdc |
#include <time.h>
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
#ifdef _WIN32
|
|
Packit |
549fdc |
# include <windows.h>
|
|
Packit |
549fdc |
# include <wincrypt.h>
|
|
Packit |
549fdc |
# if defined(NEED_CERT_ENUM_CRLS)
|
|
Packit |
549fdc |
CertEnumCRLsInStoreFunc pCertEnumCRLsInStore;
|
|
Packit |
549fdc |
static HMODULE Crypt32_dll;
|
|
Packit |
549fdc |
# endif
|
|
Packit |
549fdc |
#endif
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
/* System specific function wrappers for certificate stores.
|
|
Packit |
549fdc |
*/
|
|
Packit |
549fdc |
gnutls_time_func gnutls_time;
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
int gnutls_system_global_init(void)
|
|
Packit |
549fdc |
{
|
|
Packit |
549fdc |
#if defined(_WIN32) && defined(NEED_CERT_ENUM_CRLS)
|
|
Packit |
549fdc |
/* used in system/certs.c */
|
|
Packit |
549fdc |
HMODULE crypto;
|
|
Packit |
549fdc |
crypto = LoadLibraryA("Crypt32.dll");
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
if (crypto == NULL)
|
|
Packit |
549fdc |
return GNUTLS_E_CRYPTO_INIT_FAILED;
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
pCertEnumCRLsInStore =
|
|
Packit |
549fdc |
(CertEnumCRLsInStoreFunc) GetProcAddress(crypto,
|
|
Packit |
549fdc |
"CertEnumCRLsInStore");
|
|
Packit |
549fdc |
if (pCertEnumCRLsInStore == NULL) {
|
|
Packit |
549fdc |
FreeLibrary(crypto);
|
|
Packit |
549fdc |
return GNUTLS_E_CRYPTO_INIT_FAILED;
|
|
Packit |
549fdc |
}
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
Crypt32_dll = crypto;
|
|
Packit |
549fdc |
#endif
|
|
Packit |
549fdc |
gnutls_time = time;
|
|
Packit |
549fdc |
return 0;
|
|
Packit |
549fdc |
}
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
void gnutls_system_global_deinit(void)
|
|
Packit |
549fdc |
{
|
|
Packit |
549fdc |
#if defined(_WIN32) && defined(NEED_CERT_ENUM_CRLS)
|
|
Packit |
549fdc |
FreeLibrary(Crypt32_dll);
|
|
Packit |
549fdc |
#endif
|
|
Packit |
549fdc |
gnutls_time = time;
|
|
Packit |
549fdc |
}
|
|
Packit |
549fdc |
|
|
Packit |
549fdc |
|