diff options
Diffstat (limited to 'src/cli.c')
-rw-r--r-- | src/cli.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -1,5 +1,6 @@ /* - * Copyright (C) 2000-2012 Free Software Foundation, Inc. + * Copyright (C) 2000-2014 Free Software Foundation, Inc. + * Copyright (C) 2013-2014 Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * @@ -1615,6 +1616,25 @@ static void init_global_tls_stuff(void) { int ret; +#ifdef ENABLE_PKCS11 + if (HAVE_OPT(PROVIDER)) { + ret = gnutls_pkcs11_init(GNUTLS_PKCS11_FLAG_MANUAL, NULL); + if (ret < 0) + fprintf(stderr, "pkcs11_init: %s", + gnutls_strerror(ret)); + else { + ret = + gnutls_pkcs11_add_provider(OPT_ARG(PROVIDER), + NULL); + if (ret < 0) { + fprintf(stderr, "pkcs11_add_provider: %s", + gnutls_strerror(ret)); + exit(1); + } + } + } +#endif + /* X509 stuff */ if (gnutls_certificate_allocate_credentials(&xcred) < 0) { fprintf(stderr, "Certificate allocation memory error\n"); |