27#if PHP_USE_PHP_CRYPT_R
32# if defined(CRYPT_R_GNU_SOURCE) && !defined(_GNU_SOURCE)
48#define IS_VALID_SALT_CHARACTER(c) (((c) >= '.' && (c) <= '9') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
52#if PHP_USE_PHP_CRYPT_R
62#if PHP_USE_PHP_CRYPT_R
75 if (salt[0] ==
'*' && (salt[1] ==
'0' || salt[1] ==
'1')) {
81#if PHP_USE_PHP_CRYPT_R
85 if (salt[0]==
'$' && salt[1]==
'1' && salt[2]==
'$') {
93 }
else if (salt[0]==
'$' && salt[1]==
'6' && salt[2]==
'$') {
108 }
else if (salt[0]==
'$' && salt[1]==
'5' && salt[2]==
'$') {
141 }
else if (salt[0] ==
'_'
148 if (!crypt_res || (salt[0] ==
'*' && salt[1] ==
'0')) {
151 result = zend_string_init(crypt_res,
strlen(crypt_res), 0);
161# if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE))
162# if defined(CRYPT_R_STRUCT_CRYPT_DATA)
165# elif defined(CRYPT_R_CRYPTD)
168# error Data struct used by crypt_r() is unknown. Please report.
170 crypt_res = crypt_r(password, salt, &
buffer);
171# elif defined(HAVE_CRYPT)
172 crypt_res =
crypt(password, salt);
174# error No crypt() implementation
178 if (!crypt_res || (salt[0] ==
'*' && salt[1] ==
'0')) {
181 result = zend_string_init(crypt_res,
strlen(crypt_res), 0);
192 char *str, *salt_in =
NULL;
193 size_t str_len, salt_in_len = 0;
209 salt[salt_in_len] =
'\0';
212 if (salt[0] ==
'*' && salt[1] ==
'0') {
crypt(#[\SensitiveParameter] string $string, string $salt)
#define IS_VALID_SALT_CHARACTER(c)
PHPAPI zend_string * php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, bool quiet)
char * php_crypt_blowfish_rn(const char *key, const char *setting, char *output, int size)
char * _crypt_extended_r(const unsigned char *key, const char *setting, struct php_crypt_extended_data *data)
char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
char * php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
memset(ptr, 0, type->size)
#define PHP_MSHUTDOWN_FUNCTION
#define PHP_MINIT_FUNCTION
void php_shutdown_crypt_r(void)
void php_init_crypt_r(void)
void _crypt_extended_init_r(void)
char * php_md5_crypt_r(const char *pw, const char *salt, char *out)
#define ZEND_PARSE_PARAMETERS_END()
#define Z_PARAM_STRING(dest, dest_len)
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
struct _zend_string zend_string
#define ZEND_SECURE_ZERO(var, size)