[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/crypt_sha256.c branches/PHP_5_3/ext/standard/crypt_sha512.c trunk/ext/standard/crypt_sha256.c trunk/ext/standard/crypt_sha512.c

2010-01-14 Thread Pierre Joye
pajoye   Thu, 14 Jan 2010 19:44:54 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293558

Log:
- fix build

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
U   php/php-src/trunk/ext/standard/crypt_sha256.c
U   php/php-src/trunk/ext/standard/crypt_sha512.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2010-01-14 
18:54:43 UTC (rev 293557)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2010-01-14 
19:44:54 UTC (rev 293558)
@@ -2,10 +2,8 @@
Released into the Public Domain by Ulrich Drepper drep...@redhat.com.  */
 /* Windows VC++ port by Pierre Joye pie...@php.net */

-#ifndef PHP_WIN32
-# include php.h
-# include php_main.h
-#endif
+#include php.h
+#include php_main.h

 #include errno.h
 #include limits.h

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2010-01-14 
18:54:43 UTC (rev 293557)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2010-01-14 
19:44:54 UTC (rev 293558)
@@ -2,10 +2,8 @@
Released into the Public Domain by Ulrich Drepper drep...@redhat.com.  */
 /* Windows VC++ port by Pierre Joye pie...@php.net */

-#ifndef PHP_WIN32
-# include php.h
-# include php_main.h
-#endif
+#include php.h
+#include php_main.h

 #include errno.h
 #include limits.h

Modified: php/php-src/trunk/ext/standard/crypt_sha256.c
===
--- php/php-src/trunk/ext/standard/crypt_sha256.c   2010-01-14 18:54:43 UTC 
(rev 293557)
+++ php/php-src/trunk/ext/standard/crypt_sha256.c   2010-01-14 19:44:54 UTC 
(rev 293558)
@@ -2,10 +2,8 @@
Released into the Public Domain by Ulrich Drepper drep...@redhat.com.  */
 /* Windows VC++ port by Pierre Joye pie...@php.net */

-#ifndef PHP_WIN32
-# include php.h
-# include php_main.h
-#endif
+#include php.h
+#include php_main.h

 #include errno.h
 #include limits.h

Modified: php/php-src/trunk/ext/standard/crypt_sha512.c
===
--- php/php-src/trunk/ext/standard/crypt_sha512.c   2010-01-14 18:54:43 UTC 
(rev 293557)
+++ php/php-src/trunk/ext/standard/crypt_sha512.c   2010-01-14 19:44:54 UTC 
(rev 293558)
@@ -2,10 +2,8 @@
Released into the Public Domain by Ulrich Drepper drep...@redhat.com.  */
 /* Windows VC++ port by Pierre Joye pie...@php.net */

-#ifndef PHP_WIN32
-# include php.h
-# include php_main.h
-#endif
+#include php.h
+#include php_main.h

 #include errno.h
 #include limits.h

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/crypt_sha256.c branches/PHP_5_3/ext/standard/crypt_sha512.c trunk/ext/standard/crypt_sha256.c trunk/ext/standard/crypt_sha512.c

2010-01-11 Thread David Soria Parra
dsp  Mon, 11 Jan 2010 16:22:12 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293409

Log:
Fixes #50496. Drop stdbool.h dependency as it requires _STDC_C99 set on some 
systems.

Bug: http://bugs.php.net/50496 (Open) Use of stdbool.h is valid only in a c99 
compilation environment.
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
U   php/php-src/trunk/ext/standard/crypt_sha256.c
U   php/php-src/trunk/ext/standard/crypt_sha512.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2010-01-11 
15:26:50 UTC (rev 293408)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2010-01-11 
16:22:12 UTC (rev 293409)
@@ -12,7 +12,6 @@

 #ifdef PHP_WIN32
 # include win32/php_stdint.h
-# include win32/php_stdbool.h
 # define __alignof__ __alignof
 # define alloca _alloca
 #else
@@ -21,7 +20,6 @@
 # elif HAVE_STDINT_H
 #  include stdint.h
 # endif
-# include stdbool.h
 #endif

 #include stdio.h
@@ -364,7 +362,7 @@
char *s_bytes;
/* Default number of rounds.  */
size_t rounds = ROUNDS_DEFAULT;
-   bool rounds_custom = false;
+   zend_bool rounds_custom = 0;

/* Find beginning of salt string.  The prefix should normally always
be present.  Just in case it is not.  */
@@ -380,7 +378,7 @@
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
-   rounds_custom = true;
+   rounds_custom = 1;
}
}


Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2010-01-11 
15:26:50 UTC (rev 293408)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2010-01-11 
16:22:12 UTC (rev 293409)
@@ -11,7 +11,6 @@
 #include limits.h
 #ifdef PHP_WIN32
 # include win32/php_stdint.h
-# include win32/php_stdbool.h
 # define __alignof__ __alignof
 # define alloca _alloca
 #else
@@ -20,7 +19,6 @@
 # elif HAVE_STDINT_H
 #  include stdint.h
 # endif
-# include stdbool.h
 #endif

 #include stdio.h
@@ -391,7 +389,7 @@
char *s_bytes;
/* Default number of rounds.  */
size_t rounds = ROUNDS_DEFAULT;
-   bool rounds_custom = false;
+   zend_bool rounds_custom = 0;

/* Find beginning of salt string.  The prefix should normally always
 be present.  Just in case it is not.  */
@@ -408,7 +406,7 @@
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
-   rounds_custom = true;
+   rounds_custom = 1;
}
}


Modified: php/php-src/trunk/ext/standard/crypt_sha256.c
===
--- php/php-src/trunk/ext/standard/crypt_sha256.c   2010-01-11 15:26:50 UTC 
(rev 293408)
+++ php/php-src/trunk/ext/standard/crypt_sha256.c   2010-01-11 16:22:12 UTC 
(rev 293409)
@@ -12,7 +12,6 @@

 #ifdef PHP_WIN32
 # include win32/php_stdint.h
-# include win32/php_stdbool.h
 # define __alignof__ __alignof
 # define alloca _alloca
 #else
@@ -21,7 +20,6 @@
 # elif HAVE_STDINT_H
 #  include stdint.h
 # endif
-# include stdbool.h
 #endif

 #include stdio.h
@@ -357,7 +355,7 @@
char *s_bytes;
/* Default number of rounds.  */
size_t rounds = ROUNDS_DEFAULT;
-   bool rounds_custom = false;
+   zend_bool rounds_custom = 0;

/* Find beginning of salt string.  The prefix should normally always
be present.  Just in case it is not.  */
@@ -373,7 +371,7 @@
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
-   rounds_custom = true;
+   rounds_custom = 1;
}
}


Modified: php/php-src/trunk/ext/standard/crypt_sha512.c
===
--- php/php-src/trunk/ext/standard/crypt_sha512.c   2010-01-11 15:26:50 UTC 
(rev 293408)
+++ php/php-src/trunk/ext/standard/crypt_sha512.c   2010-01-11 16:22:12 UTC 
(rev 293409)
@@ -11,7 +11,6 @@
 #include limits.h
 #ifdef PHP_WIN32
 # include win32/php_stdint.h
-# include win32/php_stdbool.h
 # define __alignof__ __alignof
 # define alloca _alloca
 #else
@@ -20,7 +19,6 @@
 # elif HAVE_STDINT_H
 #  include stdint.h
 # endif
-# include stdbool.h
 #endif

 #include stdio.h
@@ -384,7 +382,7 @@
char *s_bytes;
/* Default number of rounds.  */

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/crypt_sha256.c branches/PHP_5_3/ext/standard/crypt_sha512.c trunk/ext/standard/crypt_sha256.c trunk/ext/standard/crypt_sha512.c

2009-12-11 Thread Pierre Joye
pajoye   Fri, 11 Dec 2009 15:57:01 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=291993

Log:
- #50334, use our own implementations of stpncpy and mempcy, avoiding weird 
behaviors on certain platforms like solaris

Bug: http://bugs.php.net/50334 (Closed) crypt ignores sha512 prefix
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
U   php/php-src/trunk/ext/standard/crypt_sha256.c
U   php/php-src/trunk/ext/standard/crypt_sha512.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2009-12-11 
15:42:16 UTC (rev 291992)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2009-12-11 
15:57:01 UTC (rev 291993)
@@ -40,8 +40,7 @@
 # endif
 #endif

-#ifndef HAVE_STRPNCPY
-char * stpncpy(char *dst, const char *src, size_t len)
+char * __php_stpncpy(char *dst, const char *src, size_t len)
 {
size_t n = strlen(src);
if (n  len) {
@@ -49,14 +48,11 @@
}
return strncpy(dst, src, len) + n;
 }
-#endif

-#ifndef HAVE_MEMPCPY
-void * mempcpy(void * dst, const void * src, size_t len)
+void * __php_mempcpy(void * dst, const void * src, size_t len)
 {
return (((char *)memcpy(dst, src, len)) + len);
 }
-#endif

 #ifndef MIN
 # define MIN(a, b) (((a)  (b)) ? (a) : (b))
@@ -457,7 +453,7 @@
/* Create byte sequence P.  */
cp = p_bytes = alloca(key_len);
for (cnt = key_len; cnt = 32; cnt -= 32) {
-   cp = mempcpy((void *)cp, (const void *)temp_result, 32);
+   cp = __php_mempcpy((void *)cp, (const void *)temp_result, 32);
}
memcpy(cp, temp_result, cnt);

@@ -475,7 +471,7 @@
/* Create byte sequence S.  */
cp = s_bytes = alloca(salt_len);
for (cnt = salt_len; cnt = 32; cnt -= 32) {
-   cp = mempcpy(cp, temp_result, 32);
+   cp = __php_mempcpy(cp, temp_result, 32);
}
memcpy(cp, temp_result, cnt);

@@ -515,7 +511,7 @@

/* Now we can construct the result string.  It consists of three
parts.  */
-   cp = stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen));
+   cp = __php_stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen));
buflen -= sizeof(sha256_salt_prefix) - 1;

if (rounds_custom) {
@@ -528,7 +524,7 @@
buflen -= n;
}

-   cp = stpncpy(cp, salt, MIN ((size_t) MAX (0, buflen), salt_len));
+   cp = __php_stpncpy(cp, salt, MIN ((size_t) MAX (0, buflen), salt_len));
buflen -= MIN((size_t) MAX (0, buflen), salt_len);

if (buflen  0) {

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2009-12-11 
15:42:16 UTC (rev 291992)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2009-12-11 
15:57:01 UTC (rev 291993)
@@ -32,21 +32,15 @@
 # include sys/param.h
 # include sys/types.h
 # if HAVE_STRING_H
-#  define __USE_GNU
 #  include string.h
 # else
 #  include strings.h
 # endif
 #endif

-#ifndef HAVE_MEMPCPY
-extern void * mempcpy(void * dst, const void * src, size_t len);
-#endif
+extern void * __php_mempcpy(void * dst, const void * src, size_t len);
+extern char * __php_stpncpy(char *dst, const char *src, size_t len);

-#ifndef HAVE_STRPNCPY
-extern char * stpncpy(char *dst, const char *src, size_t len);
-#endif
-
 #ifndef MIN
 # define MIN(a, b) (((a)  (b)) ? (a) : (b))
 #endif
@@ -488,7 +482,7 @@
/* Create byte sequence P.  */
cp = p_bytes = alloca(key_len);
for (cnt = key_len; cnt = 64; cnt -= 64) {
-   cp = mempcpy((void *) cp, (const void *)temp_result, 64);
+   cp = __php_mempcpy((void *) cp, (const void *)temp_result, 64);
}

memcpy(cp, temp_result, cnt);
@@ -507,7 +501,7 @@
/* Create byte sequence S.  */
cp = s_bytes = alloca(salt_len);
for (cnt = salt_len; cnt = 64; cnt -= 64) {
-   cp = mempcpy(cp, temp_result, 64);
+   cp = __php_mempcpy(cp, temp_result, 64);
}
memcpy(cp, temp_result, cnt);

@@ -547,7 +541,7 @@

/* Now we can construct the result string.  It consists of three
 parts.  */
-   cp = stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen));
+   cp = __php_stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen));
buflen -= sizeof(sha512_salt_prefix) - 1;

if (rounds_custom) {
@@ -560,7 +554,7 @@
  buflen -= n;
}

-   cp = stpncpy(cp, salt, MIN((size_t) MAX(0, buflen), salt_len));
+   cp = __php_stpncpy(cp, salt, MIN((size_t) MAX(0, buflen), salt_len));
buflen -= (int) MIN((size_t) MAX(0, buflen), salt_len);

 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/crypt_sha256.c branches/PHP_5_3/ext/standard/crypt_sha512.c trunk/ext/standard/crypt_sha256.c trunk/ext/standard/crypt_sha512.c

2009-12-09 Thread Pierre Joye
pajoye   Wed, 09 Dec 2009 17:40:19 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=291924

Log:
- #50334, fix build for platform without endian.h (like solaris)

Bug: http://bugs.php.net/50334 (Closed) crypt ignores sha512 prefix
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
U   php/php-src/trunk/ext/standard/crypt_sha256.c
U   php/php-src/trunk/ext/standard/crypt_sha512.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2009-12-09 
16:57:03 UTC (rev 291923)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c2009-12-09 
17:40:19 UTC (rev 291924)
@@ -3,7 +3,6 @@
 /* Windows VC++ port by Pierre Joye pie...@php.net */

 #ifndef PHP_WIN32
-# include endian.h
 # include php.h
 # include php_main.h
 #endif
@@ -75,7 +74,7 @@
char buffer[128]; /* NB: always correctly aligned for uint32_t.  */
 };

-#if PHP_WIN32 || (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if PHP_WIN32 || (!defined(WORDS_BIGENDIAN))
 # define SWAP(n) \
 (((n)  24) | (((n)  0xff00)  8) | (((n)  8)  0xff00) | ((n)  24))
 #else

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2009-12-09 
16:57:03 UTC (rev 291923)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha512.c2009-12-09 
17:40:19 UTC (rev 291924)
@@ -3,7 +3,6 @@
 /* Windows VC++ port by Pierre Joye pie...@php.net */

 #ifndef PHP_WIN32
-# include endian.h
 # include php.h
 # include php_main.h
 #endif
@@ -66,7 +65,7 @@
 };


-#if PHP_WIN32 || (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if PHP_WIN32 || (!defined(WORDS_BIGENDIAN))
 # define SWAP(n) \
   (((n)  56) \
| (((n)  0xff00)  40)\

Modified: php/php-src/trunk/ext/standard/crypt_sha256.c
===
--- php/php-src/trunk/ext/standard/crypt_sha256.c   2009-12-09 16:57:03 UTC 
(rev 291923)
+++ php/php-src/trunk/ext/standard/crypt_sha256.c   2009-12-09 17:40:19 UTC 
(rev 291924)
@@ -3,7 +3,6 @@
 /* Windows VC++ port by Pierre Joye pie...@php.net */

 #ifndef PHP_WIN32
-# include endian.h
 # include php.h
 # include php_main.h
 #endif
@@ -75,7 +74,7 @@
char buffer[128]; /* NB: always correctly aligned for uint32_t.  */
 };

-#if PHP_WIN32 || (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if PHP_WIN32 || (!defined(WORDS_BIGENDIAN))
 # define SWAP(n) \
 (((n)  24) | (((n)  0xff00)  8) | (((n)  8)  0xff00) | ((n)  24))
 #else

Modified: php/php-src/trunk/ext/standard/crypt_sha512.c
===
--- php/php-src/trunk/ext/standard/crypt_sha512.c   2009-12-09 16:57:03 UTC 
(rev 291923)
+++ php/php-src/trunk/ext/standard/crypt_sha512.c   2009-12-09 17:40:19 UTC 
(rev 291924)
@@ -3,7 +3,6 @@
 /* Windows VC++ port by Pierre Joye pie...@php.net */

 #ifndef PHP_WIN32
-# include endian.h
 # include php.h
 # include php_main.h
 #endif
@@ -66,7 +65,7 @@
 };


-#if PHP_WIN32 || (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if PHP_WIN32 || (!defined(WORDS_BIGENDIAN))
 # define SWAP(n) \
   (((n)  56) \
| (((n)  0xff00)  40)\

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php