aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2005-12-19 02:46:19 (GMT)
committerJouni Malinen <j@w1.fi>2005-12-19 02:46:19 (GMT)
commitf88de1bd95023bfe067ed8b18ca27db396f26434 (patch)
tree3c24975a8683aca3ecefdee1f6798c82b09ca51c
parentf79ae76baa60b3d7927d4b364eeb585103e16fc6 (diff)
downloadhostap-history-f88de1bd95023bfe067ed8b18ca27db396f26434.zip
hostap-history-f88de1bd95023bfe067ed8b18ca27db396f26434.tar.gz
hostap-history-f88de1bd95023bfe067ed8b18ca27db396f26434.tar.bz2
Added support for two different typecasts of d2i_X509() and
d2i_PKCS12() arguments based on the OpenSSL version (0.9.8 started using const) to get rid of compiler warnings.
-rw-r--r--wpa_supplicant/tls_openssl.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/wpa_supplicant/tls_openssl.c b/wpa_supplicant/tls_openssl.c
index a22a53a..c4a585c 100644
--- a/wpa_supplicant/tls_openssl.c
+++ b/wpa_supplicant/tls_openssl.c
@@ -31,6 +31,11 @@
#include "common.h"
#include "tls.h"
+#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
+#define OPENSSL_d2i_TYPE const unsigned char **
+#else
+#define OPENSSL_d2i_TYPE unsigned char **
+#endif
struct tls_connection {
SSL *ssl;
@@ -373,8 +378,7 @@ static int tls_cryptoapi_cert(SSL *ssl, const char *name)
goto err;
}
- cert = d2i_X509(NULL,
- (const unsigned char **) &priv->cert->pbCertEncoded,
+ cert = d2i_X509(NULL, (OPENSSL_d2i_TYPE) &priv->cert->pbCertEncoded,
priv->cert->cbCertEncoded);
if (cert == NULL) {
wpa_printf(MSG_INFO, "CryptoAPI: Could not process X509 DER "
@@ -463,8 +467,7 @@ static int tls_cryptoapi_ca_cert(SSL_CTX *ssl_ctx, SSL *ssl, const char *name)
}
while ((ctx = CertEnumCertificatesInStore(cs, ctx))) {
- cert = d2i_X509(NULL,
- (const unsigned char **) &ctx->pbCertEncoded,
+ cert = d2i_X509(NULL, (OPENSSL_d2i_TYPE) &ctx->pbCertEncoded,
ctx->cbCertEncoded);
if (cert == NULL) {
wpa_printf(MSG_INFO, "CryptoAPI: Could not process "
@@ -1054,8 +1057,7 @@ static int tls_connection_ca_cert(void *_ssl_ctx, struct tls_connection *conn,
SSL_CTX *ssl_ctx = _ssl_ctx;
if (ca_cert_blob) {
- X509 *cert = d2i_X509(NULL,
- (unsigned char **) &ca_cert_blob,
+ X509 *cert = d2i_X509(NULL, (OPENSSL_d2i_TYPE) &ca_cert_blob,
ca_cert_blob_len);
if (cert == NULL) {
tls_show_errors(MSG_WARNING, __func__,
@@ -1410,7 +1412,7 @@ static int tls_read_pkcs12_blob(SSL_CTX *ssl_ctx, SSL *ssl,
#ifdef PKCS12_FUNCS
PKCS12 *p12;
- p12 = d2i_PKCS12(NULL, (unsigned char **) &blob, len);
+ p12 = d2i_PKCS12(NULL, (OPENSSL_d2i_TYPE) &blob, len);
if (p12 == NULL) {
tls_show_errors(MSG_INFO, __func__,
"Failed to use PKCS#12 blob");