jani            Mon Aug 25 13:42:55 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       config.m4 crypt_freesec.c crypt_freesec.h 
  Log:
  MFH
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/config.m4?r1=1.80.2.3.2.3.2.5&r2=1.80.2.3.2.3.2.6&diff_format=u
Index: php-src/ext/standard/config.m4
diff -u php-src/ext/standard/config.m4:1.80.2.3.2.3.2.5 
php-src/ext/standard/config.m4:1.80.2.3.2.3.2.6
--- php-src/ext/standard/config.m4:1.80.2.3.2.3.2.5     Mon Aug 25 12:15:05 2008
+++ php-src/ext/standard/config.m4      Mon Aug 25 13:42:54 2008
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.80.2.3.2.3.2.5 2008/08/25 12:15:05 jani Exp $ -*- 
autoconf -*-
+dnl $Id: config.m4,v 1.80.2.3.2.3.2.6 2008/08/25 13:42:54 jani Exp $ -*- 
autoconf -*-
 
 divert(3)dnl
 
@@ -464,25 +464,6 @@
 fi
 
 dnl
-dnl Check for u_int32_t
-dnl
-AC_CACHE_CHECK([for u_int32_t], [ac_cv_type_u_int32_t],[
-AC_TRY_COMPILE([
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-],[
-int __tmp__() { u_int32_t a; }
-],[
-  ac_cv_type_u_int32_t=yes
-],[
-  ac_cv_type_u_int32_t=no
-])])
-if test "$ac_cv_type_u_int32_t" = "yes"; then
-  AC_DEFINE([HAVE_U_INT32_T], 1, [Define if your system has u_int32_t in 
sys/types.h])
-fi
-
-dnl
 dnl Setup extension sources
 dnl
 PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c 
crc32.c crypt.c \
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/crypt_freesec.c?r1=1.1.2.5&r2=1.1.2.6&diff_format=u
Index: php-src/ext/standard/crypt_freesec.c
diff -u php-src/ext/standard/crypt_freesec.c:1.1.2.5 
php-src/ext/standard/crypt_freesec.c:1.1.2.6
--- php-src/ext/standard/crypt_freesec.c:1.1.2.5        Sat Aug 23 20:42:18 2008
+++ php-src/ext/standard/crypt_freesec.c        Mon Aug 25 13:42:54 2008
@@ -1,5 +1,5 @@
 /*
-  $Id: crypt_freesec.c,v 1.1.2.5 2008/08/23 20:42:18 pajoye Exp $ 
+  $Id: crypt_freesec.c,v 1.1.2.6 2008/08/25 13:42:54 jani Exp $ 
 */
 /*
  * This version is derived from the original implementation of FreeSec
@@ -40,7 +40,7 @@
  * SUCH DAMAGE.
  *
  *     $Owl: Owl/packages/glibc/crypt_freesec.c,v 1.4 2005/11/16 13:08:32 
solar Exp $
- *     $Id: crypt_freesec.c,v 1.1.2.5 2008/08/23 20:42:18 pajoye Exp $
+ *     $Id: crypt_freesec.c,v 1.1.2.6 2008/08/25 13:42:54 jani Exp $
  *
  * This is an original implementation of the DES and the crypt(3) interfaces
  * by David Burren <davidb at werj.com.au>.
@@ -65,24 +65,6 @@
 #include <sys/types.h>
 #include <string.h>
 
-#ifdef TEST
-#include <stdio.h>
-#endif
-
-
-#if defined(__GNUC__)
-# ifdef inline
-# undef inline
-# endif
-# define inline inline __attribute__((always_inline))
-#elif defined(_MSC_VER)
-# define inline __forceinline
-#else
-# ifndef inline
-#  define inline
-# endif
-#endif
-
 #include "crypt_freesec.h"
 
 #define _PASSWORD_EFMT1 '_'
@@ -172,7 +154,7 @@
         2,  8, 24, 14, 32, 27,  3,  9, 19, 13, 30,  6, 22, 11,  4, 25
 };
 
-static u_int32_t bits32[32] =
+static uint32_t bits32[32] =
 {
        0x80000000, 0x40000000, 0x20000000, 0x10000000,
        0x08000000, 0x04000000, 0x02000000, 0x01000000,
@@ -192,11 +174,11 @@
 /*       0123456789012345678901234567890123456789012345678901234567890123 */
 
 static u_char m_sbox[4][4096];
-static u_int32_t psbox[4][256];
-static u_int32_t ip_maskl[8][256], ip_maskr[8][256];
-static u_int32_t fp_maskl[8][256], fp_maskr[8][256];
-static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
-static u_int32_t comp_maskl[8][128], comp_maskr[8][128];
+static uint32_t psbox[4][256];
+static uint32_t ip_maskl[8][256], ip_maskr[8][256];
+static uint32_t fp_maskl[8][256], fp_maskr[8][256];
+static uint32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
+static uint32_t comp_maskl[8][128], comp_maskr[8][128];
 
 static inline int
 ascii_to_bin(char ch)
@@ -220,8 +202,8 @@
 _crypt_extended_init(void)
 {
        int i, j, b, k, inbit, obit;
-       u_int32_t *p, *il, *ir, *fl, *fr;
-       u_int32_t *bits28, *bits24;
+       uint32_t *p, *il, *ir, *fl, *fr;
+       uint32_t *bits28, *bits24;
        u_char inv_key_perm[64];
        u_char u_key_perm[56];
        u_char inv_comp_perm[56];
@@ -359,9 +341,9 @@
 }
 
 static void
-setup_salt(u_int32_t salt, struct php_crypt_extended_data *data)
+setup_salt(uint32_t salt, struct php_crypt_extended_data *data)
 {
-       u_int32_t       obit, saltbit, saltbits;
+       uint32_t        obit, saltbit, saltbits;
        int     i;
 
        if (salt == data->old_salt)
@@ -383,19 +365,19 @@
 static int
 des_setkey(const char *key, struct php_crypt_extended_data *data)
 {
-       u_int32_t       k0, k1, rawkey0, rawkey1;
+       uint32_t        k0, k1, rawkey0, rawkey1;
        int     shifts, round;
 
        rawkey0 =
-               (u_int32_t)(u_char)key[3] |
-               ((u_int32_t)(u_char)key[2] << 8) |
-               ((u_int32_t)(u_char)key[1] << 16) |
-               ((u_int32_t)(u_char)key[0] << 24);
+               (uint32_t)(u_char)key[3] |
+               ((uint32_t)(u_char)key[2] << 8) |
+               ((uint32_t)(u_char)key[1] << 16) |
+               ((uint32_t)(u_char)key[0] << 24);
        rawkey1 =
-               (u_int32_t)(u_char)key[7] |
-               ((u_int32_t)(u_char)key[6] << 8) |
-               ((u_int32_t)(u_char)key[5] << 16) |
-               ((u_int32_t)(u_char)key[4] << 24);
+               (uint32_t)(u_char)key[7] |
+               ((uint32_t)(u_char)key[6] << 8) |
+               ((uint32_t)(u_char)key[5] << 16) |
+               ((uint32_t)(u_char)key[4] << 24);
 
        if ((rawkey0 | rawkey1)
            && rawkey0 == data->old_rawkey0
@@ -435,7 +417,7 @@
         */
        shifts = 0;
        for (round = 0; round < 16; round++) {
-               u_int32_t       t0, t1;
+               uint32_t        t0, t1;
 
                shifts += key_shifts[round];
 
@@ -466,14 +448,14 @@
 }
 
 static int
-do_des(u_int32_t l_in, u_int32_t r_in, u_int32_t *l_out, u_int32_t *r_out,
+do_des(uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out,
        int count, struct php_crypt_extended_data *data)
 {
        /*
         *      l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
         */
-       u_int32_t       l, r, *kl, *kr, *kl1, *kr1;
-       u_int32_t       f, r48l, r48r, saltbits;
+       uint32_t        l, r, *kl, *kr, *kl1, *kr1;
+       uint32_t        f, r48l, r48r, saltbits;
        int     round;
 
        if (count == 0) {
@@ -584,24 +566,24 @@
 }
 
 static int
-des_cipher(const char *in, char *out, u_int32_t salt, int count,
+des_cipher(const char *in, char *out, uint32_t salt, int count,
        struct php_crypt_extended_data *data)
 {
-       u_int32_t       l_out, r_out, rawl, rawr;
+       uint32_t        l_out, r_out, rawl, rawr;
        int     retval;
 
        setup_salt(salt, data);
 
        rawl =
-               (u_int32_t)(u_char)in[3] |
-               ((u_int32_t)(u_char)in[2] << 8) |
-               ((u_int32_t)(u_char)in[1] << 16) |
-               ((u_int32_t)(u_char)in[0] << 24);
+               (uint32_t)(u_char)in[3] |
+               ((uint32_t)(u_char)in[2] << 8) |
+               ((uint32_t)(u_char)in[1] << 16) |
+               ((uint32_t)(u_char)in[0] << 24);
        rawr =
-               (u_int32_t)(u_char)in[7] |
-               ((u_int32_t)(u_char)in[6] << 8) |
-               ((u_int32_t)(u_char)in[5] << 16) |
-               ((u_int32_t)(u_char)in[4] << 24);
+               (uint32_t)(u_char)in[7] |
+               ((uint32_t)(u_char)in[6] << 8) |
+               ((uint32_t)(u_char)in[5] << 16) |
+               ((uint32_t)(u_char)in[4] << 24);
 
        retval = do_des(rawl, rawr, &l_out, &r_out, count, data);
 
@@ -622,7 +604,7 @@
        struct php_crypt_extended_data *data)
 {
        int             i;
-       u_int32_t       count, salt, l, r0, r1, keybuf[2];
+       uint32_t        count, salt, l, r0, r1, keybuf[2];
        u_char          *p, *q;
 
        if (!data->initialized)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/crypt_freesec.h?r1=1.1.2.6&r2=1.1.2.7&diff_format=u
Index: php-src/ext/standard/crypt_freesec.h
diff -u php-src/ext/standard/crypt_freesec.h:1.1.2.6 
php-src/ext/standard/crypt_freesec.h:1.1.2.7
--- php-src/ext/standard/crypt_freesec.h:1.1.2.6        Sat Aug 23 21:08:09 2008
+++ php-src/ext/standard/crypt_freesec.h        Mon Aug 25 13:42:55 2008
@@ -1,17 +1,24 @@
-/* $Id: crypt_freesec.h,v 1.1.2.6 2008/08/23 21:08:09 pajoye Exp $ */
+/* $Id: crypt_freesec.h,v 1.1.2.7 2008/08/25 13:42:55 jani Exp $ */
+
 #ifndef _CRYPT_FREESEC_H
 #define _CRYPT_FREESEC_H
 
+#include "php_config.h"
 
 #if PHP_WIN32
 # include "win32/php_stdint.h"
 #else
-# include "php_config.h"
-# if HAVE_STDINT_H
-# include <stdint.h>
+# if HAVE_INTTYPES_H
+#  include <inttypes.h>
+# elif HAVE_STDINT_H
+#  include <stdint.h>
 # endif
-# ifndef HAVE_U_INT32_T
-   typedef uint32_t u_int32_t;
+# ifndef HAVE_UINT32_T
+#  if SIZEOF_INT == 4
+typedef unsigned int uint32_t;
+#  elif SIZEOF_LONG == 4
+typedef unsigned long int uint32_t;
+#  endif
 # endif
 #endif
 
@@ -19,11 +26,11 @@
 
 struct php_crypt_extended_data {
        int initialized;
-       u_int32_t saltbits;
-       u_int32_t old_salt;
-       u_int32_t en_keysl[16], en_keysr[16];
-       u_int32_t de_keysl[16], de_keysr[16];
-       u_int32_t old_rawkey0, old_rawkey1;
+       uint32_t saltbits;
+       uint32_t old_salt;
+       uint32_t en_keysl[16], en_keysr[16];
+       uint32_t de_keysl[16], de_keysr[16];
+       uint32_t old_rawkey0, old_rawkey1;
        char output[21];
 };
 

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

Reply via email to