mirror of
https://github.com/php/php-src.git
synced 2026-03-26 09:12:14 +01:00
Remove PHP_*_CRYPT constants
They are always 1.
This commit is contained in:
@@ -284,13 +284,6 @@ else
|
||||
AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, 1, [Whether the system supports standard DES salt])
|
||||
AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, 1, [Whether the system supports BlowFish salt])
|
||||
AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, 1, [Whether the system supports extended DES salt])
|
||||
AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, 1, [Whether the system supports MD5 salt])
|
||||
AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, 1, [Whether the system supports SHA512 salt])
|
||||
AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, 1, [Whether the system supports SHA256 salt])
|
||||
|
||||
dnl
|
||||
dnl Check for available functions
|
||||
dnl
|
||||
|
||||
@@ -59,44 +59,8 @@
|
||||
#include "php_crypt.h"
|
||||
#include "php_rand.h"
|
||||
|
||||
/* The capabilities of the crypt() function is determined by the test programs
|
||||
* run by configure from aclocal.m4. They will set PHP_STD_DES_CRYPT,
|
||||
* PHP_EXT_DES_CRYPT, PHP_MD5_CRYPT and PHP_BLOWFISH_CRYPT as appropriate
|
||||
* for the target platform. */
|
||||
|
||||
#if PHP_STD_DES_CRYPT
|
||||
#define PHP_MAX_SALT_LEN 2
|
||||
#endif
|
||||
|
||||
#if PHP_EXT_DES_CRYPT
|
||||
#undef PHP_MAX_SALT_LEN
|
||||
#define PHP_MAX_SALT_LEN 9
|
||||
#endif
|
||||
|
||||
#if PHP_MD5_CRYPT
|
||||
#undef PHP_MAX_SALT_LEN
|
||||
#define PHP_MAX_SALT_LEN 12
|
||||
#endif
|
||||
|
||||
#if PHP_BLOWFISH_CRYPT
|
||||
#undef PHP_MAX_SALT_LEN
|
||||
#define PHP_MAX_SALT_LEN 60
|
||||
#endif
|
||||
|
||||
#if PHP_SHA512_CRYPT
|
||||
#undef PHP_MAX_SALT_LEN
|
||||
/* sha512 crypt has the maximal salt length of 123 characters */
|
||||
#define PHP_MAX_SALT_LEN 123
|
||||
#endif
|
||||
|
||||
|
||||
/* If the configure-time checks fail, we provide DES.
|
||||
* XXX: This is a hack. Fix the real problem! */
|
||||
|
||||
#ifndef PHP_MAX_SALT_LEN
|
||||
#define PHP_MAX_SALT_LEN 2
|
||||
#undef PHP_STD_DES_CRYPT
|
||||
#define PHP_STD_DES_CRYPT 1
|
||||
#endif
|
||||
|
||||
#define PHP_CRYPT_RAND php_rand()
|
||||
|
||||
@@ -109,18 +73,12 @@
|
||||
PHP_MINIT_FUNCTION(crypt) /* {{{ */
|
||||
{
|
||||
REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#ifdef PHP_SHA256_CRYPT
|
||||
REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
#ifdef PHP_SHA512_CRYPT
|
||||
REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("CRYPT_STD_DES", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_MD5", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_SHA256", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CRYPT_SHA512", 1, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#if PHP_USE_PHP_CRYPT_R
|
||||
php_init_crypt_r();
|
||||
@@ -309,15 +267,10 @@ PHP_FUNCTION(crypt)
|
||||
|
||||
/* The automatic salt generation covers standard DES, md5-crypt and Blowfish (simple) */
|
||||
if (!*salt) {
|
||||
#if PHP_MD5_CRYPT
|
||||
strncpy(salt, "$1$", PHP_MAX_SALT_LEN);
|
||||
php_to64(&salt[3], PHP_CRYPT_RAND, 4);
|
||||
php_to64(&salt[7], PHP_CRYPT_RAND, 4);
|
||||
strncpy(&salt[11], "$", PHP_MAX_SALT_LEN - 11);
|
||||
#elif PHP_STD_DES_CRYPT
|
||||
php_to64(&salt[0], PHP_CRYPT_RAND, 2);
|
||||
salt[2] = '\0';
|
||||
#endif
|
||||
salt_in_len = strlen(salt);
|
||||
} else {
|
||||
salt_in_len = MIN(PHP_MAX_SALT_LEN, salt_in_len);
|
||||
|
||||
@@ -24,12 +24,6 @@
|
||||
|
||||
/* Enable / Disable crypt() function (default: enabled) */
|
||||
#define HAVE_CRYPT 1
|
||||
#define PHP_STD_DES_CRYPT 1
|
||||
#define PHP_EXT_DES_CRYPT 1
|
||||
#define PHP_MD5_CRYPT 1
|
||||
#define PHP_BLOWFISH_CRYPT 1
|
||||
#define PHP_SHA512_CRYPT 1
|
||||
#define PHP_SHA256_CRYPT 1
|
||||
|
||||
/* PHP Runtime Configuration */
|
||||
#define PHP_URL_FOPEN 1
|
||||
|
||||
Reference in New Issue
Block a user