1
0
mirror of https://github.com/php/php-src.git synced 2026-04-09 09:03:04 +02:00

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
This commit is contained in:
ULF WENDEL
2012-10-23 13:15:46 +02:00
3 changed files with 30 additions and 8 deletions

4
NEWS
View File

@@ -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:

View File

@@ -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 \

View File

@@ -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);
while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) {
EVP_SignUpdate(&md_ctx, buf, sig_len);
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;
}
if (!EVP_SignFinal (&md_ctx, sigbuf,(unsigned int *)&siglen, key)) {
while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) {
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)) {
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;