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
efree(sig);
}
break;
-#if HAVE_HASH_EXT
+#if PHAR_HASH_OK
case PHAR_SIG_SHA512: {
unsigned char digest[64];
}
switch(phar->sig_flags) {
-#ifndef HAVE_HASH_EXT
+#ifndef PHAR_HASH_OK
case PHAR_SIG_SHA512:
case PHAR_SIG_SHA256:
if (closeoldfile) {
#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
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
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:
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
<?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
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
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
*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;
}
switch(phar->sig_flags) {
-#ifdef HAVE_HASH_EXT
+#ifdef PHAR_HASH_OK
case PHAR_SIG_SHA512: {
unsigned char digest[64];
PHP_SHA512_CTX context;