Fixing compilation of the OpenSSL plugin if ENGINE support is disabled.

That is, enable compilation if OpenSSL was configured with
OPENSSL_NO_ENGINE.
This commit is contained in:
Tobias Brunner
2010-06-22 11:55:34 +02:00
parent 5a367e99c3
commit 1e3d66f8d3
2 changed files with 14 additions and 2 deletions
@@ -14,10 +14,12 @@
* for more details. * for more details.
*/ */
#include <openssl/conf.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/engine.h> #include <openssl/conf.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
#include "openssl_plugin.h" #include "openssl_plugin.h"
@@ -200,7 +202,9 @@ static void destroy(private_openssl_plugin_t *this)
lib->creds->remove_builder(lib->creds, lib->creds->remove_builder(lib->creds,
(builder_function_t)openssl_crl_load); (builder_function_t)openssl_crl_load);
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup(); ENGINE_cleanup();
#endif /* OPENSSL_NO_ENGINE */
EVP_cleanup(); EVP_cleanup();
CONF_modules_free(); CONF_modules_free();
@@ -223,9 +227,11 @@ plugin_t *openssl_plugin_create()
OPENSSL_config(NULL); OPENSSL_config(NULL);
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
#ifndef OPENSSL_NO_ENGINE
/* activate support for hardware accelerators */ /* activate support for hardware accelerators */
ENGINE_load_builtin_engines(); ENGINE_load_builtin_engines();
ENGINE_register_all_complete(); ENGINE_register_all_complete();
#endif /* OPENSSL_NO_ENGINE */
/* crypter */ /* crypter */
lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
@@ -21,7 +21,9 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h> #include <openssl/engine.h>
#endif /* OPENSSL_NO_ENGINE */
/** /**
* Public exponent to use for key generation. * Public exponent to use for key generation.
@@ -447,6 +449,7 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type,
openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type, openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
va_list args) va_list args)
{ {
#ifndef OPENSSL_NO_ENGINE
private_openssl_rsa_private_key_t *this; private_openssl_rsa_private_key_t *this;
char *keyid = NULL, *pin = NULL; char *keyid = NULL, *pin = NULL;
EVP_PKEY *key; EVP_PKEY *key;
@@ -511,5 +514,8 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
this->engine = TRUE; this->engine = TRUE;
return &this->public; return &this->public;
#else /* OPENSSL_NO_ENGINE */
return NULL;
#endif /* OPENSSL_NO_ENGINE */
} }