AC_DEFINE(PHP_MHASH_BC, 1, [ ])
fi
+dnl Defined for BC.
AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
if test $ac_cv_c_bigendian_php = yes; then
AC_DEFINE('PHP_MHASH_BC', 1);
}
+// Defined for BC.
AC_DEFINE('HAVE_HASH_EXT', 1);
PHP_HASH = 'yes';
STANDARD_MODULE_PROPERTIES
};
/* }}} */
-
-#ifdef COMPILE_DL_HASH
-ZEND_GET_MODULE(hash)
-#endif
--TEST--
Hash: Attempt to instantiate a HashContext directly
---SKIPIF--
-<?php if (!extension_loaded('hash')) echo 'skip';
--FILE--
<?php
--TEST--
Hash: Attempt to reuse a closed hash context
---SKIPIF--
-<?php if (!extension_loaded('hash')) echo 'skip';
--FILE--
<?php
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,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
AC_MSG_CHECKING([for phar openssl support])
- if test "$PHP_HASH_SHARED" != "yes"; then
- if test "$PHP_HASH" != "no"; then
- AC_DEFINE(PHAR_HASH_OK,1,[ ])
- fi
- 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
STDOUT.WriteLine(' Native OpenSSL support in Phar disabled');
}
}
- if (PHP_HASH != "no") {
- if (!PHP_HASH_SHARED) {
- AC_DEFINE("PHAR_HASH_OK", 1);
- } else {
- WARNING('Phar: sha256/sha512 signature support disabled if ext/hash is built shared');
- }
- }
ADD_EXTENSION_DEP('phar', 'spl', true);
ADD_MAKEFILE_FRAGMENT();
efree(sig);
}
break;
-#if PHAR_HASH_OK
case PHAR_SIG_SHA512: {
unsigned char digest[64];
}
break;
}
-#else
- case PHAR_SIG_SHA512:
- case PHAR_SIG_SHA256:
- efree(savebuf);
- php_stream_close(fp);
-
- if (error) {
- spprintf(error, 0, "phar \"%s\" has a unsupported signature", fname);
- }
- return FAILURE;
-#endif
case PHAR_SIG_SHA1: {
unsigned char digest[20];
}
switch(phar->sig_flags) {
-#ifndef PHAR_HASH_OK
- case PHAR_SIG_SHA512:
- case PHAR_SIG_SHA256:
- if (closeoldfile) {
- php_stream_close(oldfile);
- }
- php_stream_close(newfile);
- if (error) {
- spprintf(error, 0, "unable to write contents of file \"%s\" to new phar \"%s\" with requested hash type", entry->filename, phar->fname);
- }
- return EOF;
-#endif
default: {
char *digest = NULL;
size_t digest_len;
ZEND_MOD_OPTIONAL("openssl")
ZEND_MOD_OPTIONAL("zlib")
ZEND_MOD_OPTIONAL("standard")
-#if defined(HAVE_HASH) && !defined(COMPILE_DL_HASH)
ZEND_MOD_REQUIRED("hash")
-#endif
ZEND_MOD_REQUIRED("spl")
ZEND_MOD_END
};
#include "ext/spl/spl_exceptions.h"
#include "ext/spl/spl_iterators.h"
#include "php_phar.h"
-#ifdef PHAR_HASH_OK
#include "ext/hash/php_hash.h"
#include "ext/hash/php_hash_sha.h"
-#endif
/* PHP_ because this is public information via MINFO */
#define PHP_PHAR_API_VERSION "1.1.1"
add_next_index_stringl(return_value, "MD5", 3);
add_next_index_stringl(return_value, "SHA-1", 5);
-#ifdef PHAR_HASH_OK
add_next_index_stringl(return_value, "SHA-256", 7);
add_next_index_stringl(return_value, "SHA-512", 7);
-#endif
#if PHAR_HAVE_OPENSSL
add_next_index_stringl(return_value, "OpenSSL", 7);
#else
switch (algo) {
case PHAR_SIG_SHA256:
case PHAR_SIG_SHA512:
-#ifndef PHAR_HASH_OK
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
- "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:
case PHAR_SIG_SHA1:
case PHAR_SIG_OPENSSL:
--SKIPIF--
<?php
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 enabled");
if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared");
--SKIPIF--
<?php
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");
--SKIPIF--
<?php
if (!extension_loaded("phar")) die("skip");
-if (!extension_loaded("hash")) die("skip hash 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");
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
$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"); ?>
--SKIPIF--
<?php
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");
Phar::setSupportedSignatures() with hash, zip-based
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
-<?php if (!extension_loaded("hash")) die("skip extension hash required");
+<?php
$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"); ?>
*/
#include "phar_internal.h"
-#ifdef PHAR_HASH_OK
#include "ext/hash/php_hash_sha.h"
-#endif
#ifdef PHAR_HAVE_OPENSSL
/* OpenSSL includes */
*signature_len = phar_hex_str((const char*)sig, sig_len, signature);
}
break;
-#ifdef PHAR_HASH_OK
case PHAR_SIG_SHA512: {
unsigned char digest[64];
PHP_SHA512_CTX context;
*signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature);
break;
}
-#else
- case PHAR_SIG_SHA512:
- case PHAR_SIG_SHA256:
- if (error) {
- spprintf(error, 0, "unsupported signature");
- }
- return FAILURE;
-#endif
case PHAR_SIG_SHA1: {
unsigned char digest[20];
PHP_SHA1_CTX context;
}
switch(phar->sig_flags) {
-#ifdef PHAR_HASH_OK
case PHAR_SIG_SHA512: {
unsigned char digest[64];
PHP_SHA512_CTX context;
*signature_length = 32;
break;
}
-#else
- case PHAR_SIG_SHA512:
- case PHAR_SIG_SHA256:
- if (error) {
- spprintf(error, 0, "unable to write to phar \"%s\" with requested hash type", phar->fname);
- }
-
- return FAILURE;
-#endif
case PHAR_SIG_OPENSSL: {
unsigned char *sigbuf;
#ifdef PHAR_HAVE_OPENSSL
#define PHP_SESSION_H
#include "ext/standard/php_var.h"
-
-#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
-# include "ext/hash/php_hash.h"
-#endif
+#include "ext/hash/php_hash.h"
#define PHP_SESSION_API 20161017
setting hash_function to sha512 and hash_bits_per_character > 4 should not crash
--SKIPIF--
<?php include('skipif.inc'); ?>
-<?php if (!extension_loaded('hash')) die('skip hash extension not available'); ?>
--INI--
session.use_cookies=0
session.cache_limiter=
#if HAVE_FTP
,phpext_ftp_ptr
#endif
-#if HAVE_HASH
,phpext_hash_ptr
-#endif
#if HAVE_ICONV
,phpext_iconv_ptr
#endif