diff options
author | Greg Beaver <cellog@php.net> | 2008-10-09 00:50:47 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2008-10-09 00:50:47 +0000 |
commit | fffdf661c95b15896d4c60060ca00e6adfb0da0e (patch) | |
tree | a8c173a6e1db39a6eb6ed8956752864835af4615 /ext/phar | |
parent | 529105427e5af3d6b7366b22abf4660b8fb407a9 (diff) | |
download | php-git-fffdf661c95b15896d4c60060ca00e6adfb0da0e.tar.gz |
fix bug #45907: undefined reference to PHP_SHA512Init
Diffstat (limited to 'ext/phar')
-rw-r--r-- | ext/phar/config.m4 | 5 | ||||
-rw-r--r-- | ext/phar/phar.c | 4 | ||||
-rwxr-xr-x | ext/phar/phar_internal.h | 2 | ||||
-rwxr-xr-x | ext/phar/phar_object.c | 6 | ||||
-rw-r--r-- | ext/phar/tests/phar_get_supported_signatures_002a.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/phar_setsignaturealgo2.phpt | 4 | ||||
-rw-r--r-- | ext/phar/tests/tar/phar_setsignaturealgo2.phpt | 6 | ||||
-rw-r--r-- | ext/phar/tests/test_signaturealgos.phpt | 1 | ||||
-rw-r--r-- | ext/phar/util.c | 4 |
9 files changed, 22 insertions, 11 deletions
diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index 8fba62ff9a..5e32c5b6f2 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -7,6 +7,11 @@ PHP_ARG_ENABLE(phar, for phar archive support, if test "$PHP_PHAR" != "no"; then PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared) AC_MSG_CHECKING([for phar openssl support]) + if test "$PHP_HASH_SHARED" != "yes"; then + AC_DEFINE(PHAR_HASH_OK,1,[ ]) + else + AC_MSG_WARN([Phar: sha256/sha512 signature support disabled if ext/hash is built shared]) + fi if test "$PHP_OPENSSL_SHARED" = "yes"; then AC_MSG_RESULT([no (shared openssl)]) else diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 7ae4af4f26..ec608a84d3 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -838,7 +838,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char efree(sig); } break; -#if HAVE_HASH_EXT +#if PHAR_HASH_OK case PHAR_SIG_SHA512: { unsigned char digest[64]; @@ -3108,7 +3108,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, } switch(phar->sig_flags) { -#ifndef HAVE_HASH_EXT +#ifndef PHAR_HASH_OK case PHAR_SIG_SHA512: case PHAR_SIG_SHA256: if (closeoldfile) { diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index ed042e9746..7e0a59c43b 100755 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -66,7 +66,7 @@ #ifdef HAVE_STDINT_H #include <stdint.h> #endif -#ifdef HAVE_HASH_EXT +#ifdef PHAR_HASH_OK #include "ext/hash/php_hash.h" #include "ext/hash/php_hash_sha.h" #endif diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 2d9d028426..440017bd89 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1271,7 +1271,7 @@ PHP_METHOD(Phar, getSupportedSignatures) add_next_index_stringl(return_value, "MD5", 3, 1); add_next_index_stringl(return_value, "SHA-1", 5, 1); -#ifdef HAVE_HASH_EXT +#ifdef PHAR_HASH_OK add_next_index_stringl(return_value, "SHA-256", 7, 1); add_next_index_stringl(return_value, "SHA-512", 7, 1); #endif @@ -2939,9 +2939,9 @@ PHP_METHOD(Phar, setSignatureAlgorithm) switch (algo) { case PHAR_SIG_SHA256: case PHAR_SIG_SHA512: -#ifndef HAVE_HASH_EXT +#ifndef PHAR_HASH_OK zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, - "SHA-256 and SHA-512 signatures are only supported if the hash extension is enabled"); + "SHA-256 and SHA-512 signatures are only supported if the hash extension is enabled and built non-shared"); return; #endif case PHAR_SIG_MD5: diff --git a/ext/phar/tests/phar_get_supported_signatures_002a.phpt b/ext/phar/tests/phar_get_supported_signatures_002a.phpt index ce907ff638..154d1806c6 100644 --- a/ext/phar/tests/phar_get_supported_signatures_002a.phpt +++ b/ext/phar/tests/phar_get_supported_signatures_002a.phpt @@ -6,6 +6,7 @@ if (!extension_loaded("phar")) die("skip"); if (!extension_loaded("hash")) die("skip extension hash required"); $arr = Phar::getSupportedSignatures(); if (!in_array("OpenSSL", $arr)) die("skip openssl support required"); +if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared"); ?> --INI-- phar.require_hash=0 diff --git a/ext/phar/tests/phar_setsignaturealgo2.phpt b/ext/phar/tests/phar_setsignaturealgo2.phpt index e3f858d5d6..66edb61222 100644 --- a/ext/phar/tests/phar_setsignaturealgo2.phpt +++ b/ext/phar/tests/phar_setsignaturealgo2.phpt @@ -4,7 +4,9 @@ Phar::setSupportedSignatures() with hash <?php if (!extension_loaded("phar")) die("skip"); if (!extension_loaded("hash")) die("skip hash extension required"); -if (!extension_loaded("openssl")) die("skip openssl extension required"); +$arr = Phar::getSupportedSignatures(); +if (!in_array("OpenSSL", $arr)) die("skip openssl support required"); +if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared"); ?> --INI-- phar.require_hash=0 diff --git a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt index e9cbdb4a5d..422ca90e8a 100644 --- a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt +++ b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt @@ -2,8 +2,10 @@ Phar::setSupportedSignatures() with hash, tar-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (!extension_loaded("hash")) die("skip extension hash required"); ?> -<?php if (!extension_loaded("openssl")) die("skip extension openssl required"); ?> +<?php if (!extension_loaded("hash")) die("skip extension hash required"); +$arr = Phar::getSupportedSignatures(); +if (!in_array("OpenSSL", $arr)) die("skip openssl support required"); +if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared"); ?> --INI-- phar.require_hash=0 phar.readonly=0 diff --git a/ext/phar/tests/test_signaturealgos.phpt b/ext/phar/tests/test_signaturealgos.phpt index 2ef7ca109f..7cbf6c0513 100644 --- a/ext/phar/tests/test_signaturealgos.phpt +++ b/ext/phar/tests/test_signaturealgos.phpt @@ -6,6 +6,7 @@ if (!extension_loaded("phar")) die("skip"); if (!extension_loaded("hash")) die("skip extension hash conflicts"); $arr = Phar::getSupportedSignatures(); if (!in_array("OpenSSL", $arr)) die("skip openssl support required"); +if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared"); ?> --INI-- phar.require_hash=0 diff --git a/ext/phar/util.c b/ext/phar/util.c index 0701cb8803..7e9c50ac64 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1875,7 +1875,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ *signature_len = phar_hex_str((const char*)sig, sig_len, signature TSRMLS_CC); } break; -#ifdef HAVE_HASH_EXT +#ifdef PHAR_HASH_OK case PHAR_SIG_SHA512: { unsigned char digest[64]; PHP_SHA512_CTX context; @@ -2039,7 +2039,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat } switch(phar->sig_flags) { -#ifdef HAVE_HASH_EXT +#ifdef PHAR_HASH_OK case PHAR_SIG_SHA512: { unsigned char digest[64]; PHP_SHA512_CTX context; |