summaryrefslogtreecommitdiff
path: root/ext/openssl/openssl.c
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2013-10-09 12:30:42 +0200
committerMichael Wallner <mike@php.net>2013-10-09 12:30:42 +0200
commit3b3c57e79e46098e432fc497eb5a59eae25becce (patch)
treeb04990c1353111e57f4ccc06280a66cc5e5fb3c5 /ext/openssl/openssl.c
parent36fb4ed9685fa4d8b5c5e7255b097e5888623f2d (diff)
parent22700890d4c332b76866c73a5a68c76f601257a6 (diff)
downloadphp-git-3b3c57e79e46098e432fc497eb5a59eae25becce.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: C89 compatibility
Diffstat (limited to 'ext/openssl/openssl.c')
-rw-r--r--ext/openssl/openssl.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 2e948b098a..59a58b1c00 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4703,18 +4703,20 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
}
#if OPENSSL_VERSION_NUMBER < 0x10001001L
- /* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
- X509 *cert = NULL;
- EVP_PKEY *key = NULL;
- SSL *tmpssl = SSL_new(ctx);
- cert = SSL_get_certificate(tmpssl);
-
- if (cert) {
- key = X509_get_pubkey(cert);
- EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
- EVP_PKEY_free(key);
- }
- SSL_free(tmpssl);
+ do {
+ /* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
+ X509 *cert = NULL;
+ EVP_PKEY *key = NULL;
+ SSL *tmpssl = SSL_new(ctx);
+ cert = SSL_get_certificate(tmpssl);
+
+ if (cert) {
+ key = X509_get_pubkey(cert);
+ EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
+ EVP_PKEY_free(key);
+ }
+ SSL_free(tmpssl);
+ } while (0);
#endif
if (!SSL_CTX_check_private_key(ctx)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!");