Skip to content

Commit 631983e

Browse files
committed
correct the styles
1 parent 39af57c commit 631983e

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

ext/standard/crypt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */
6767
}
6868
/* }}} */
6969

70-
PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, bool quiet)
70+
PHPAPI zend_string *php_crypt(const char *password, size_t pass_len, const char *salt, int salt_len, bool quiet)
7171
{
7272
char *crypt_res;
7373
zend_string *result;
@@ -220,7 +220,7 @@ PHP_FUNCTION(crypt)
220220
salt_in_len = MIN(PHP_MAX_SALT_LEN, salt_in_len);
221221
salt[salt_in_len] = '\0';
222222

223-
if ((result = php_crypt(str, (int)str_len, salt, (int)salt_in_len, 0)) == NULL) {
223+
if ((result = php_crypt(str, str_len, salt, (int)salt_in_len, 0)) == NULL) {
224224
if (salt[0] == '*' && salt[1] == '0') {
225225
RETURN_STRING("*1");
226226
} else {

ext/standard/crypt_blowfish.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,13 @@ static void BF_set_key(const char *key, size_t key_len, BF_key expanded,
596596
* chars 2, 3, 4 in each four-char block, we set bit 7 of "sign" if sign
597597
* extension in tmp[1] occurs. Once this flag is set, it remains set.
598598
*/
599-
if (j)
599+
if (j) {
600600
sign |= tmp[1] & 0x80;
601+
}
601602
key_pos++;
602-
if (key_pos > key_len)
603+
if (key_pos > key_len) {
603604
key_pos = 0;
605+
}
604606
}
605607
diff |= tmp[0] ^ tmp[1]; /* Non-zero on any differences */
606608

ext/standard/password.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static bool php_password_bcrypt_needs_rehash(const zend_string *hash, zend_array
153153

154154
static bool php_password_bcrypt_verify(const zend_string *password, const zend_string *hash) {
155155
int status = 0;
156-
zend_string *ret = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
156+
zend_string *ret = php_crypt(ZSTR_VAL(password), ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
157157

158158
if (!ret) {
159159
return false;
@@ -201,7 +201,7 @@ static zend_string* php_password_bcrypt_hash(const zend_string *password, zend_a
201201
zend_string_release_ex(salt, 0);
202202

203203
/* This cast is safe, since both values are defined here in code and cannot overflow */
204-
result = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
204+
result = php_crypt(ZSTR_VAL(password), ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
205205
zend_string_release_ex(hash, 0);
206206

207207
if (!result) {

ext/standard/php_crypt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#ifndef PHP_CRYPT_H
2020
#define PHP_CRYPT_H
2121

22-
PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, bool quiet);
22+
#include <stddef.h>
23+
24+
PHPAPI zend_string *php_crypt(const char *password, size_t pass_len, const char *salt, int salt_len, bool quiet);
2325
PHP_MINIT_FUNCTION(crypt);
2426
PHP_MSHUTDOWN_FUNCTION(crypt);
2527
PHP_RINIT_FUNCTION(crypt);

0 commit comments

Comments
 (0)