Skip to content

Commit 3b3c57e

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: C89 compatibility
2 parents 36fb4ed + 2270089 commit 3b3c57e

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

ext/openssl/openssl.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4703,18 +4703,20 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
47034703
}
47044704

47054705
#if OPENSSL_VERSION_NUMBER < 0x10001001L
4706-
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
4707-
X509 *cert = NULL;
4708-
EVP_PKEY *key = NULL;
4709-
SSL *tmpssl = SSL_new(ctx);
4710-
cert = SSL_get_certificate(tmpssl);
4711-
4712-
if (cert) {
4713-
key = X509_get_pubkey(cert);
4714-
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
4715-
EVP_PKEY_free(key);
4716-
}
4717-
SSL_free(tmpssl);
4706+
do {
4707+
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
4708+
X509 *cert = NULL;
4709+
EVP_PKEY *key = NULL;
4710+
SSL *tmpssl = SSL_new(ctx);
4711+
cert = SSL_get_certificate(tmpssl);
4712+
4713+
if (cert) {
4714+
key = X509_get_pubkey(cert);
4715+
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
4716+
EVP_PKEY_free(key);
4717+
}
4718+
SSL_free(tmpssl);
4719+
} while (0);
47184720
#endif
47194721
if (!SSL_CTX_check_private_key(ctx)) {
47204722
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!");

0 commit comments

Comments
 (0)