Skip to content

Commit 2270089

Browse files
committed
C89 compatibility
1 parent b026993 commit 2270089

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
@@ -4640,18 +4640,20 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
46404640
}
46414641

46424642
#if OPENSSL_VERSION_NUMBER < 0x10001001L
4643-
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
4644-
X509 *cert = NULL;
4645-
EVP_PKEY *key = NULL;
4646-
SSL *tmpssl = SSL_new(ctx);
4647-
cert = SSL_get_certificate(tmpssl);
4648-
4649-
if (cert) {
4650-
key = X509_get_pubkey(cert);
4651-
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
4652-
EVP_PKEY_free(key);
4653-
}
4654-
SSL_free(tmpssl);
4643+
do {
4644+
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
4645+
X509 *cert = NULL;
4646+
EVP_PKEY *key = NULL;
4647+
SSL *tmpssl = SSL_new(ctx);
4648+
cert = SSL_get_certificate(tmpssl);
4649+
4650+
if (cert) {
4651+
key = X509_get_pubkey(cert);
4652+
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
4653+
EVP_PKEY_free(key);
4654+
}
4655+
SSL_free(tmpssl);
4656+
} while (0);
46554657
#endif
46564658
if (!SSL_CTX_check_private_key(ctx)) {
46574659
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!");

0 commit comments

Comments
 (0)