diff --git a/.gitignore b/.gitignore index fcc32a2..254661d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ php-7.0.*.xz /php-7.1.10RC1.tar.xz /php-7.1.10.tar.xz /php-7.2.0RC3.tar.xz +/php-7.2.0RC4.tar.xz diff --git a/php-7.2.0-hash3.patch b/php-7.2.0-hash3.patch deleted file mode 100644 index 35574ff..0000000 --- a/php-7.2.0-hash3.patch +++ /dev/null @@ -1,310 +0,0 @@ -From d3ff2d35daab910198d505be20ddad0587026cb7 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 29 Sep 2017 14:38:21 +0200 -Subject: [PATCH] Fix Bug #75284 sha3 is not supported on bigendian machine - ---- - ext/hash/config.m4 | 32 ++++--- - ext/hash/hash_sha3.c | 214 +++++++++++++++++++++++++++++++++++++++++++++++ - ext/hash/php_hash_sha3.h | 5 ++ - 3 files changed, 239 insertions(+), 12 deletions(-) - -diff --git a/ext/hash/config.m4 b/ext/hash/config.m4 -index 66cc7ca8108f..932e6d6f22c6 100644 ---- a/ext/hash/config.m4 -+++ b/ext/hash/config.m4 -@@ -24,25 +24,33 @@ if test "$PHP_HASH" != "no"; then - AC_CHECK_SIZEOF(int, 4) - AC_CHECK_SIZEOF(long, 4) - AC_CHECK_SIZEOF(long long, 8) -- -- PHP_CHECK_64BIT([ -- SHA3_DIR="sha3/generic32lc" -- SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-inplace32BI.c" -- ],[ -- SHA3_DIR="sha3/generic64lc" -- SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c" -- ]) -- EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c" -- PHP_HASH_CFLAGS="-I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded" -+ -+ if test $ac_cv_c_bigendian_php = yes; then -+ EXT_HASH_SHA3_SOURCES="hash_sha3.c" -+ AC_DEFINE(HAVE_SLOW_HASH3, 1, [Define is hash3 algo is available]) -+ AC_MSG_WARN("Use SHA3 slow implementation on bigendian") -+ else -+ PHP_CHECK_64BIT([ -+ SHA3_DIR="sha3/generic32lc" -+ SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-inplace32BI.c" -+ ],[ -+ SHA3_DIR="sha3/generic64lc" -+ SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c" -+ ]) -+ EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c hash_sha3.c" -+ PHP_HASH_CFLAGS="-I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded" -+ -+ PHP_ADD_BUILD_DIR(ext/hash/$SHA3_DIR, 1) -+ fi -+ - EXT_HASH_SOURCES="hash.c hash_md.c hash_sha.c hash_ripemd.c hash_haval.c \ - hash_tiger.c hash_gost.c hash_snefru.c hash_whirlpool.c hash_adler32.c \ -- hash_crc32.c hash_fnv.c hash_joaat.c hash_sha3.c $EXT_HASH_SHA3_SOURCES" -+ hash_crc32.c hash_fnv.c hash_joaat.c $EXT_HASH_SHA3_SOURCES" - EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \ - php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \ - php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \ - php_hash_fnv.h php_hash_joaat.h php_hash_sha3.h" - -- PHP_ADD_BUILD_DIR(ext/hash/$SHA3_DIR, 1) - PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared,,$PHP_HASH_CFLAGS) - ifdef([PHP_INSTALL_HEADERS], [ - PHP_INSTALL_HEADERS(ext/hash, $EXT_HASH_HEADERS) -diff --git a/ext/hash/hash_sha3.c b/ext/hash/hash_sha3.c -index ee9d010da4b2..98010c535019 100644 ---- a/ext/hash/hash_sha3.c -+++ b/ext/hash/hash_sha3.c -@@ -19,6 +19,217 @@ - #include "php_hash.h" - #include "php_hash_sha3.h" - -+#ifdef HAVE_SLOW_HASH3 -+// ================= slow algo ============================================== -+ -+#if (defined(__APPLE__) || defined(__APPLE_CC__)) && \ -+ (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) -+# if defined(__LITTLE_ENDIAN__) -+# undef WORDS_BIGENDIAN -+# else -+# if defined(__BIG_ENDIAN__) -+# define WORDS_BIGENDIAN -+# endif -+# endif -+#endif -+ -+static inline uint64_t rol64(uint64_t v, unsigned char b) { -+ return (v << b) | (v >> (64 - b)); -+} -+static inline unsigned char idx(unsigned char x, unsigned char y) { -+ return x + (5 * y); -+} -+ -+#ifdef WORDS_BIGENDIAN -+static inline uint64_t load64(const unsigned char* x) { -+ signed char i; -+ uint64_t ret = 0; -+ for (i = 7; i >= 0; --i) { -+ ret <<= 8; -+ ret |= x[i]; -+ } -+ return ret; -+} -+static inline void store64(unsigned char* x, uint64_t val) { -+ char i; -+ for (i = 0; i < 8; ++i) { -+ x[i] = val & 0xFF; -+ val >>= 8; -+ } -+} -+static inline void xor64(unsigned char* x, uint64_t val) { -+ char i; -+ for (i = 0; i < 8; ++i) { -+ x[i] ^= val & 0xFF; -+ val >>= 8; -+ } -+} -+# define readLane(x, y) load64(ctx->state+sizeof(uint64_t)*idx(x, y)) -+# define writeLane(x, y, v) store64(ctx->state+sizeof(uint64_t)*idx(x, y), v) -+# define XORLane(x, y, v) xor64(ctx->state+sizeof(uint64_t)*idx(x, y), v) -+#else -+# define readLane(x, y) (((uint64_t*)ctx->state)[idx(x,y)]) -+# define writeLane(x, y, v) (((uint64_t*)ctx->state)[idx(x,y)] = v) -+# define XORLane(x, y, v) (((uint64_t*)ctx->state)[idx(x,y)] ^= v) -+#endif -+ -+static inline char LFSR86540(unsigned char* pLFSR) -+{ -+ unsigned char LFSR = *pLFSR; -+ char result = LFSR & 0x01; -+ if (LFSR & 0x80) { -+ // Primitive polynomial over GF(2): x^8+x^6+x^5+x^4+1 -+ LFSR = (LFSR << 1) ^ 0x71; -+ } else { -+ LFSR <<= 1; -+ } -+ *pLFSR = LFSR; -+ return result; -+} -+ -+static void permute(PHP_SHA3_CTX* ctx) { -+ unsigned char LFSRstate = 0x01; -+ unsigned char round; -+ -+ for (round = 0; round < 24; ++round) { -+ { // Theta step (see [Keccak Reference, Section 2.3.2]) -+ uint64_t C[5], D; -+ unsigned char x, y; -+ for (x = 0; x < 5; ++x) { -+ C[x] = readLane(x, 0) ^ readLane(x, 1) ^ -+ readLane(x, 2) ^ readLane(x, 3) ^ readLane(x, 4); -+ } -+ for (x = 0; x < 5; ++x) { -+ D = C[(x+4)%5] ^ rol64(C[(x+1)%5], 1); -+ for (y = 0; y < 5; ++y) { -+ XORLane(x, y, D); -+ } -+ } -+ } -+ -+ { // p and Pi steps (see [Keccak Reference, Sections 2.3.3 and 2.3.4]) -+ unsigned char x = 1, y = 0, t; -+ uint64_t current = readLane(x, y); -+ for (t = 0; t < 24; ++t) { -+ unsigned char r = ((t + 1) * (t + 2) / 2) % 64; -+ unsigned char Y = (2*x + 3*y) % 5; -+ uint64_t temp; -+ x = y; -+ y = Y; -+ temp = readLane(x, y); -+ writeLane(x, y, rol64(current, r)); -+ current = temp; -+ } -+ } -+ -+ { // X step (see [Keccak Reference, Section 2.3.1]) -+ unsigned char x, y; -+ for (y = 0; y < 5; ++y) { -+ uint64_t temp[5]; -+ for (x = 0; x < 5; ++x) { -+ temp[x] = readLane(x, y); -+ } -+ for (x = 0; x < 5; ++x) { -+ writeLane(x, y, temp[x] ^((~temp[(x+1)%5]) & temp[(x+2)%5])); -+ } -+ } -+ } -+ -+ { // i step (see [Keccak Reference, Section 2.3.5]) -+ unsigned char j; -+ for (j = 0; j < 7; ++j) { -+ if (LFSR86540(&LFSRstate)) { -+ uint64_t bitPos = (1< 0) { -+ unsigned int len = block_size - ctx->pos; -+ if (len > count) len = count; -+ count -= len; -+ while (len-- > 0) { -+ ctx->state[ctx->pos++] ^= *(buf++); -+ } -+ if (ctx->pos >= block_size) { -+ permute(ctx); -+ ctx->pos = 0; -+ } -+ } -+} -+ -+static void PHP_SHA3_Final(unsigned char* digest, -+ PHP_SHA3_CTX* ctx, -+ int block_size, -+ int digest_size) { -+ int len = digest_size; -+ -+ // Pad state to finalize -+ ctx->state[ctx->pos++] ^= 0x06; -+ ctx->state[block_size-1] ^= 0x80; -+ permute(ctx); -+ -+ // Square output for digest -+ for(;;) { -+ int bs = (len < block_size) ? len : block_size; -+ memcpy(digest, ctx->state, bs); -+ digest += bs; -+ len -= bs; -+ if (!len) break; -+ permute(ctx); -+ } -+ -+ // Zero out context -+ memset(ctx, 0, sizeof(PHP_SHA3_CTX)); -+} -+ -+// ========================================================================== -+ -+#define DECLARE_SHA3_OPS(bits) \ -+void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx) { \ -+ PHP_SHA3_Init(ctx, bits); \ -+} \ -+void PHP_SHA3##bits##Update(PHP_SHA3_##bits##_CTX* ctx, \ -+ const unsigned char* input, \ -+ unsigned int inputLen) { \ -+ PHP_SHA3_Update(ctx, input, inputLen, \ -+ (1600 - (2 * bits)) >> 3); \ -+} \ -+void PHP_SHA3##bits##Final(unsigned char* digest, \ -+ PHP_SHA3_##bits##_CTX* ctx) { \ -+ PHP_SHA3_Final(digest, ctx, \ -+ (1600 - (2 * bits)) >> 3, \ -+ bits >> 3); \ -+} \ -+const php_hash_ops php_hash_sha3_##bits##_ops = { \ -+ (php_hash_init_func_t) PHP_SHA3##bits##Init, \ -+ (php_hash_update_func_t) PHP_SHA3##bits##Update, \ -+ (php_hash_final_func_t) PHP_SHA3##bits##Final, \ -+ php_hash_copy, \ -+ bits >> 3, \ -+ (1600 - (2 * bits)) >> 3, \ -+ sizeof(PHP_SHA3_##bits##_CTX), \ -+ 1 \ -+} -+ -+#else -+ -+// ================= fast algo ============================================== -+ - #define SUCCESS SHA3_SUCCESS /* Avoid conflict between KeccacHash.h and zend_types.h */ - #include "KeccakHash.h" - -@@ -60,6 +271,9 @@ const php_hash_ops php_hash_sha3_##bits##_ops = { \ - 1 \ - } - -+#endif -+// ================= both algo ============================================== -+ - DECLARE_SHA3_OPS(224); - DECLARE_SHA3_OPS(256); - DECLARE_SHA3_OPS(384); -diff --git a/ext/hash/php_hash_sha3.h b/ext/hash/php_hash_sha3.h -index b47d1b102f37..73f0f8af3662 100644 ---- a/ext/hash/php_hash_sha3.h -+++ b/ext/hash/php_hash_sha3.h -@@ -22,7 +22,12 @@ - #include "php.h" - - typedef struct { -+#ifdef HAVE_SLOW_HASH3 -+ unsigned char state[200]; // 5 * 5 * sizeof(uint64) -+ uint32_t pos; -+#else - void *hashinstance; -+#endif - } PHP_SHA3_CTX; - - typedef PHP_SHA3_CTX PHP_SHA3_224_CTX; diff --git a/php-7.2.0-pcre.patch b/php-7.2.0-pcre.patch deleted file mode 100644 index efaf8c5..0000000 --- a/php-7.2.0-pcre.patch +++ /dev/null @@ -1,61 +0,0 @@ -Adapted for 7.2.0RC3 from -https://github.com/php/php-src/commit/7c8357929cc3e0cabcb312c3fae48f6fb949944e - - - -diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 -index cc9f1b2..d4ccea6 100644 ---- a/ext/pcre/config0.m4 -+++ b/ext/pcre/config0.m4 -@@ -9,6 +9,8 @@ PHP_ARG_WITH(pcre-regex,, - [ --with-pcre-regex=DIR Include Perl Compatible Regular Expressions support. - DIR is the PCRE install prefix [BUNDLED]], yes, no) - -+PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality], yes, no) -+ - if test "$PHP_PCRE_REGEX" != "yes" && test "$PHP_PCRE_REGEX" != "no"; then - AC_MSG_CHECKING([for PCRE headers location]) - for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre $PHP_PCRE_REGEX/local/include; do -@@ -43,6 +45,13 @@ PHP_ARG_WITH(pcre-regex,, - AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 6.6]) - fi - -+ PHP_CHECK_LIBRARY(pcre, pcre_jit_exec, -+ [ -+ AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) -+ ],[ -+ ],[ -+ -L$PCRE_LIBDIR -+ ]) - PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR) - - AC_DEFINE(HAVE_PCRE, 1, [ ]) -@@ -65,19 +74,19 @@ PHP_ARG_WITH(pcre-regex,, - PHP_ADD_BUILD_DIR($ext_builddir/pcrelib) - PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/]) - AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) -- fi - --PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality], yes, no) -- if test "$PHP_PCRE_REGEX" != "no"; then -- AC_MSG_CHECKING([whether to enable PCRE JIT functionality]) -- if test "$PHP_PCRE_JIT" != "no"; then -- AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) -- AC_MSG_RESULT([yes]) -- else -- AC_MSG_RESULT([no]) -+ if test "$PHP_PCRE_REGEX" != "no"; then -+ AC_MSG_CHECKING([whether to enable PCRE JIT functionality]) -+ if test "$PHP_PCRE_JIT" != "no"; then -+ AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) -+ AC_MSG_RESULT([yes]) -+ else -+ AC_MSG_RESULT([no]) -+ fi - fi - fi - -+ - if test "$PHP_DEBUG" != "no" && test "$PHP_DEBUG" != "0"; then - PHP_ARG_WITH(pcre-valgrind,,[ --with-pcre-valgrind=DIR - Enable PCRE valgrind support. Developers only!], yes, no) diff --git a/php.spec b/php.spec index 90373c1..1b4937b 100644 --- a/php.spec +++ b/php.spec @@ -62,7 +62,7 @@ %endif %global upver 7.2.0 -%global rcver RC3 +%global rcver RC4 Summary: PHP scripting language for creating dynamic web sites Name: php @@ -112,12 +112,6 @@ Patch45: php-5.6.3-ldap_r.patch Patch46: php-7.2.0-fixheader.patch # drop "Configure command" from phpinfo output Patch47: php-5.6.3-phpinfo.patch -# disable sha3 for bigendian -# https://bugs.php.net/75284 -Patch48: php-7.2.0-hash3.patch -# check jit support in libpcre -# https://bugs.php.net/75285 -Patch49: php-7.2.0-pcre.patch # Upstream fixes (100+) @@ -730,8 +724,6 @@ low-level PHP extension for the libsodium cryptographic library. %endif %patch46 -p1 -b .fixheader %patch47 -p1 -b .phpinfo -%patch48 -p1 -b .sha3 -%patch49 -p1 -b .jit # upstream patches @@ -1526,6 +1518,9 @@ rm -f README.{Zeus,QNX,CVS-RULES} %changelog +* Tue Oct 10 2017 Remi Collet - 7.2.0~RC4-1 +- Update to 7.2.0RC4 + * Fri Sep 29 2017 Remi Collet - 7.2.0~RC3-1 - Update to 7.2.0RC3 - drop mcrypt extension diff --git a/sources b/sources index 221b2aa..cbb4105 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (php-7.2.0RC3.tar.xz) = a33e72e458e7e9fef59db5c147da9efdbd6d2987610216d99fd6c8bb25927153573614bdf3ca3b4e3278c5e6657fbd30665e3a895448afb0d6951af65e8e5b55 +SHA512 (php-7.2.0RC4.tar.xz) = cd56b698a3090f5d0a113a9038adc9c8b562c4c5bddc89b4718bb358253a17c11054888dd0a4daa042cb07a836f6e5f9d5a29f0d73356946e2619b13a6b4c0ea