diff options
author | ULF WENDEL <uw@php.net> | 2012-10-23 13:15:46 +0200 |
---|---|---|
committer | ULF WENDEL <uw@php.net> | 2012-10-23 13:15:46 +0200 |
commit | bac9d118edb6b54cb9cfa80fefdc2d46609efebc (patch) | |
tree | 6a565606843fcf2fc7d43baa9766b51f66ae153d | |
parent | dfeb91acc7d44cc5035db34a31310dc3075df11f (diff) | |
parent | 6e23cfeba48cc10fe59d3dacfea90ccb1a2f1dd4 (diff) | |
download | php-git-bac9d118edb6b54cb9cfa80fefdc2d46609efebc.tar.gz |
Merge branch 'PHP-5.3' of git.php.net:php-src into PHP-5.3
* 'PHP-5.3' of git.php.net:php-src:
fixed a typo in the error message
Fixed bug #63297 Phar fails to write an openssl based signature
enabled libxpm for gd on windows
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/gd/config.w32 | 6 | ||||
-rw-r--r-- | ext/phar/util.c | 26 |
3 files changed, 29 insertions, 7 deletions
@@ -22,6 +22,10 @@ PHP NEWS . Fixed bug #63240 (stream_get_line() return contains delimiter string). (Tjerk, Gustavo) +- Phar: + . Fixed bug #63297 (Phar fails to write an openssl based signature). + (Anatoliy) + 18 Oct 2012, PHP 5.3.18 - Core: diff --git a/ext/gd/config.w32 b/ext/gd/config.w32 index 8f1c13f610..9b5eb7bcef 100644 --- a/ext/gd/config.w32 +++ b/ext/gd/config.w32 @@ -13,7 +13,9 @@ if (PHP_GD != "no") { (CHECK_LIB("libiconv_a.lib;libiconv.lib", "gd", PHP_GD) || CHECK_LIB("iconv_a.lib;iconv.lib", "gd", PHP_GD)) && CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_GD", PHP_GD) && (((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD) )) || - (PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) + (PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) && + CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) && + CHECK_HEADER_ADD_INCLUDE("xpm.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\X11") ) { if (PHP_T1LIB != "no") { if (CHECK_LIB("T1_StaticMD.lib", "gd", PHP_GD) && @@ -54,6 +56,7 @@ if (PHP_GD != "no") { /D HAVE_GD_STRINGTTF=1 \ /D HAVE_GD_WBMP \ /D HAVE_GD_XBM \ +/D HAVE_GD_XPM \ /D HAVE_LIBFREETYPE=1 \ /D HAVE_LIBGD13=1 \ /D HAVE_LIBGD15=1 \ @@ -61,6 +64,7 @@ if (PHP_GD != "no") { /D HAVE_LIBGD204=1 \ /D HAVE_LIBJPEG \ /D HAVE_LIBPNG \ +/D HAVE_XPM \ /D HAVE_COLORCLOSESTHWB \ /D USE_GD_IMGSTRTTF \ /D USE_GD_IOCTX \ diff --git a/ext/phar/util.c b/ext/phar/util.c index cc4457493b..08faaa65ef 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -2119,8 +2119,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat #ifdef PHAR_HAVE_OPENSSL BIO *in; EVP_PKEY *key; - EVP_MD *mdtype = (EVP_MD *) EVP_sha1(); - EVP_MD_CTX md_ctx; + EVP_MD_CTX *md_ctx; in = BIO_new_mem_buf(PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len)); @@ -2141,15 +2140,30 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat return FAILURE; } + md_ctx = EVP_MD_CTX_create(); + siglen = EVP_PKEY_size(key); sigbuf = emalloc(siglen + 1); - EVP_SignInit(&md_ctx, mdtype); + + if (!EVP_SignInit(md_ctx, EVP_sha1())) { + efree(sigbuf); + if (error) { + spprintf(error, 0, "unable to initialize openssl signature for phar \"%s\"", phar->fname); + } + return FAILURE; + } while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) { - EVP_SignUpdate(&md_ctx, buf, sig_len); + if (!EVP_SignUpdate(md_ctx, buf, sig_len)) { + efree(sigbuf); + if (error) { + spprintf(error, 0, "unable to update the openssl signature for phar \"%s\"", phar->fname); + } + return FAILURE; + } } - if (!EVP_SignFinal (&md_ctx, sigbuf,(unsigned int *)&siglen, key)) { + if (!EVP_SignFinal (md_ctx, sigbuf,(unsigned int *)&siglen, key)) { efree(sigbuf); if (error) { spprintf(error, 0, "unable to write phar \"%s\" with requested openssl signature", phar->fname); @@ -2158,7 +2172,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat } sigbuf[siglen] = '\0'; - EVP_MD_CTX_cleanup(&md_ctx); + EVP_MD_CTX_destroy(md_ctx); #else sigbuf = NULL; siglen = 0; |