[packages] php4: fix OpenSSL v1.0.0 fallout...

git-svn-id: svn://svn.openwrt.org/openwrt/packages@25651 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2011-02-21 19:44:17 +00:00
parent 53fe371f27
commit 6405afe906

View File

@ -0,0 +1,72 @@
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -47,6 +47,13 @@
#define DEBUG_SMIME 0
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#define OPENSSL_D2I_X509_CAST d2i_of_void *
+#else
+#define OPENSSL_D2I_X509_CAST char *(*)()
+#define LHASH_OF(x) LHASH
+#endif
+
static unsigned char arg2_force_ref[] =
{ 2, BYREF_NONE, BYREF_FORCE };
static unsigned char arg2and3_force_ref[] =
@@ -179,8 +186,8 @@ inline static int php_openssl_safe_mode_
static char default_ssl_conf_filename[MAXPATHLEN];
struct php_x509_request {
- LHASH * global_config; /* Global SSL config */
- LHASH * req_config; /* SSL config for this request */
+ LHASH_OF(CONF_VALUE) * global_config; /* Global SSL config */
+ LHASH_OF(CONF_VALUE) * req_config; /* SSL config for this request */
const EVP_MD * md_alg;
const EVP_MD * digest;
char * section_name,
@@ -340,7 +347,7 @@ static inline int php_openssl_config_che
const char * section_label,
const char * config_filename,
const char * section,
- LHASH * config TSRMLS_DC)
+ LHASH_OF(CONF_VALUE) * config TSRMLS_DC)
{
X509V3_CTX ctx;
@@ -720,7 +727,7 @@ static X509 * php_openssl_x509_from_zval
if (in == NULL)
return NULL;
- cert = (X509 *) PEM_ASN1_read_bio((char *(*)())d2i_X509,
+ cert = (X509 *) PEM_ASN1_read_bio((OPENSSL_D2I_X509_CAST)d2i_X509,
PEM_STRING_X509, in,
NULL, NULL, NULL);
BIO_free(in);
@@ -1859,7 +1866,7 @@ static int php_openssl_is_private_key(EV
case EVP_PKEY_RSA2:
assert(pkey->pkey.rsa != NULL);
- if (NULL == pkey->pkey.rsa->p || NULL == pkey->pkey.rsa->q)
+ if (NULL == pkey->pkey.rsa || NULL == pkey->pkey.rsa->p || NULL == pkey->pkey.rsa->q)
return 0;
break;
#endif
@@ -1871,7 +1878,7 @@ static int php_openssl_is_private_key(EV
case EVP_PKEY_DSA4:
assert(pkey->pkey.dsa != NULL);
- if (NULL == pkey->pkey.dsa->p || NULL == pkey->pkey.dsa->q || NULL == pkey->pkey.dsa->priv_key)
+ if (NULL == pkey->pkey.dsa || NULL == pkey->pkey.dsa->p || NULL == pkey->pkey.dsa->q || NULL == pkey->pkey.dsa->priv_key)
return 0;
break;
#endif
@@ -1879,7 +1886,7 @@ static int php_openssl_is_private_key(EV
case EVP_PKEY_DH:
assert(pkey->pkey.dh != NULL);
- if (NULL == pkey->pkey.dh->p || NULL == pkey->pkey.dh->priv_key)
+ if (NULL == pkey->pkey.dh || NULL == pkey->pkey.dh->p || NULL == pkey->pkey.dh->priv_key)
return 0;
break;
#endif