mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix formatting issues in password.c
This commit is contained in:
parent
5f44be03af
commit
0dd2f16b14
1 changed files with 71 additions and 66 deletions
|
@ -33,8 +33,6 @@
|
|||
#include "win32/winutil.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
PHP_MINIT_FUNCTION(password) /* {{{ */
|
||||
{
|
||||
REGISTER_STRING_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT);
|
||||
|
@ -49,7 +47,7 @@ PHP_MINFO_FUNCTION(password) /* {{{ */
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_password_salt_is_alphabet(const char *str, const int len)
|
||||
static int php_password_salt_is_alphabet(const char *str, const int len) /* {{{ */
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -60,8 +58,9 @@ static int php_password_salt_is_alphabet(const char *str, const int len)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_password_salt_to64(const char *str, const int str_len, const int out_len, char *ret)
|
||||
static int php_password_salt_to64(const char *str, const int str_len, const int out_len, char *ret) /* {{{ */
|
||||
{
|
||||
int pos = 0;
|
||||
unsigned char *buffer;
|
||||
|
@ -79,10 +78,11 @@ static int php_password_salt_to64(const char *str, const int str_len, const int
|
|||
efree(buffer);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define PHP_PASSWORD_FUNCTION_EXISTS(func, func_len) (zend_hash_find(EG(function_table), (func), (func_len) + 1, (void **) &func_ptr) == SUCCESS && func_ptr->type == ZEND_INTERNAL_FUNCTION && func_ptr->internal_function.handler != zif_display_disabled_function)
|
||||
|
||||
static int php_password_make_salt(long length, int raw, char *ret TSRMLS_DC)
|
||||
static int php_password_make_salt(long length, int raw, char *ret TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
int buffer_valid = 0;
|
||||
long i, raw_length;
|
||||
|
@ -131,7 +131,6 @@ static int php_password_make_salt(long length, int raw, char *ret TSRMLS_DC)
|
|||
buffer[i] ^= (char) (255.0 * php_rand(TSRMLS_C) / RAND_MAX);
|
||||
}
|
||||
}
|
||||
/* /Temp Placeholder */
|
||||
|
||||
if (raw) {
|
||||
memcpy(ret, buffer, length);
|
||||
|
@ -152,7 +151,10 @@ static int php_password_make_salt(long length, int raw, char *ret TSRMLS_DC)
|
|||
ret[length] = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto boolean password_make_salt(string password, string hash)
|
||||
Verify a hash created using crypt() or password_hash() */
|
||||
PHP_FUNCTION(password_verify)
|
||||
{
|
||||
zval *password, *hash, *ret;
|
||||
|
@ -193,7 +195,10 @@ PHP_FUNCTION(password_verify)
|
|||
RETURN_BOOL(status == 0);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string password_make_salt(int length, boolean raw_output = false)
|
||||
Make a new random salt */
|
||||
PHP_FUNCTION(password_make_salt)
|
||||
{
|
||||
char *salt;
|
||||
|
@ -217,7 +222,7 @@ PHP_FUNCTION(password_make_salt)
|
|||
}
|
||||
RETURN_STRINGL(salt, length, 0);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string password_hash(string password, string algo = PASSWORD_DEFAULT, array options = array())
|
||||
Hash a password */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue