PHP 4.0 Bug #8834 Updated: crypt() starts from not random salt
| From: | muhlig at us dot edu dot pl | Date: | Thu, 05 Apr 2001 20:03:09 +0000 |
| Subject: | PHP 4.0 Bug #8834 Updated: crypt() starts from not random salt | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50975@lists.php.net to get a copy of this message | ||
ID: 8834
User Update by: muhlig@us.edu.pl
Status: Open
Bug Type: Strings related
Description: crypt() starts from not random salt
here you are:
Solaris 2.4:
# grep RAND main/php_config.h
#define HAVE_LRAND48 1
#define HAVE_RAND_R 1
/* #undef HAVE_RANDOM */
#define HAVE_SRAND48 1
/* #undef HAVE_SRANDOM */
# uname -a
SunOS helios 5.4 Generic_101945-60 sun4d sparc
#
Solaris 2.6
# grep RAND main/php_config.h
#define HAVE_LRAND48 1
#define HAVE_RAND_R 1
#define HAVE_RANDOM 1
#define HAVE_SRAND48 1
#define HAVE_SRANDOM 1
# uname -a
SunOS uranos 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
#
unfortunately I'm not able to discuss the solution, although I can test the one provided :-)),
thank you
Previous Comments:
---------------------------------------------------------------------------
[2001-04-05 15:14:41] muhlig@us.edu.pl
here you are:
Solaris 2.4:
# grep RAND main/php_config.h
#define HAVE_LRAND48 1
#define HAVE_RAND_R 1
/* #undef HAVE_RANDOM */
#define HAVE_SRAND48 1
/* #undef HAVE_SRANDOM */
# uname -a
SunOS helios 5.4 Generic_101945-60 sun4d sparc
#
Solaris 2.6
# grep RAND main/php_config.h
#define HAVE_LRAND48 1
#define HAVE_RAND_R 1
#define HAVE_RANDOM 1
#define HAVE_SRAND48 1
#define HAVE_SRANDOM 1
# uname -a
SunOS uranos 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
#
unfortunately I'm not able to discuss the solution, although I can test the one provided :-)),
thank you
---------------------------------------------------------------------------
[2001-04-05 14:57:44] sniper@php.net
This is most likely a Solaris specific issue as I can't
reproduce this on Linux.
Can you please include the output of this command in both
Solaris 2.4 and 2.6 (in php4):
# grep RAND main/php_config.h
It might be that in both of those system the seed generator
found is srand() which isn't so good as srandom() is.
But I also found (with google :) that srandom() might not be
that good either (in Solaris) so that leaves us with a problem.
One solution might be that we run php_srand() in RINIT instead of MINIT when Solaris is used.
--Jani
---------------------------------------------------------------------------
[2001-01-22 06:05:34] muhlig@us.edu.pl
PHP compiled as Apache module. Look like crypt() starts from not random salt. In case of my Solaris
2.4, first crypt() call always generates string starting from "IH". In case of Solaris 2.6
it always starts from "C.".
Looks like in every instantiation of new Apache process PHP starts crypt from the same salt value.
In the same process next crypt() calls look like they generate random strings, though. But next
process restarts with the same value.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8834