1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00
Commit Graph

15 Commits

Author SHA1 Message Date
Tim Düsterhus c840f71524 crypt: Fix validation of malformed BCrypt hashes
PHP’s implementation of crypt_blowfish differs from the upstream Openwall
version by adding a “PHP Hack”, which allows one to cut short the BCrypt salt
by including a `$` character within the characters that represent the salt.

Hashes that are affected by the “PHP Hack” may erroneously validate any
password as valid when used with `password_verify` and when comparing the
return value of `crypt()` against the input.

The PHP Hack exists since the first version of PHP’s own crypt_blowfish
implementation that was added in 1e820eca02.

No clear reason is given for the PHP Hack’s existence. This commit removes it,
because BCrypt hashes containing a `$` character in their salt are not valid
BCrypt hashes.
2023-02-12 20:46:44 -07:00
Dmitry Stogov 4a2ae84188 Add "const". Move constant strings to read-only memory. 2020-09-07 21:35:48 +03:00
Alex Dowad 19d3e29bf5 Clean house in cryptographic hashing code
- Remove dead code from php_crypt_r.c

  This code has been commented out since the file was added in 2008. It's safe to say
  that no-one is ever going to use it.

- Fix typo in comment in php_crypt_r.c

- Remove redundant Windows-only implementation of php_md5_crypt_r

  There is a portable implementation in the same file, which is selected if not
  building for Windows. But why should Windows have its own special implementation
  of this function at all? There doesn't seem to be any good reason.

  Better to use the portable implementation on all platforms.

- Don't define useless __CONST macro in php_crypt_r.h

  This preprocessor macro is not used anywhere.

- Add comment on functions for encoding data as Base64

- Remove dead code from crypt_blowfish.h

- Remove unneeded junk comments from crypt_freesec.c

- Remove dead code from crypt_blowfish.c

  This function has been commented out since 2011.
2020-06-24 13:40:27 +02:00
George Peter Banyard 389c2b4303 Drop BF_ASM constant as it's always 0
Closes GH-5531
2020-05-06 17:55:32 +02:00
Peter Kokot 8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Anatol Belski 669fda00b7 Bug #73058 crypt broken when salt is 'too' long 2016-09-10 02:39:28 +02:00
Xinchen Hui 0579e8278d bump year 2015-01-15 23:26:37 +08:00
Leigh e331f9af73 Upgrade crypt_blowfish to version 1.3 2014-10-07 11:23:24 +01:00
Pierre Joye 03315d9625 - update blowfish to 1.2 (Solar Designer) 2011-07-18 21:26:29 +00:00
Stanislav Malyshev b158091ed6 Fix crypt_blowfish 8-bit chars problem (CVE-2011-2483), add tests
# See details at http://www.openwall.com/lists/announce/2011/06/21/1
2011-06-26 21:34:39 +00:00
Kalle Sommer Nielsen cb50011016 Fixed compiler warnings in the standard library 2010-09-23 03:45:36 +00:00
Pierre Joye c402adc3b2 - Corrected the sanity check of the "setting" string in _crypt_blowfish_rn() to
reject iteration counts encoded as 36 through 39.  Previously, these would be
  misinterpreted as being the same as 04 through 07. (Solar Designer)
2010-02-21 23:47:14 +00:00
Pierre Joye 4cb1d57fd5 - sync with 1.0.2, improve perf x86-64 (patch by Solar Designer) 2009-06-08 08:44:15 +00:00
Scott MacVicar e30b104148 Fix build where __const is already defined like OS X. 2008-07-29 01:20:28 +00:00
Pierre Joye 1e820eca02 -MFH:
- #45430, windows implementation of crypt is not TS
 - add Blowfish (using implementation from Solar Designer <solar at openwal dot com>) and extended DES support
 - Make crypt features portable:
   - if no crypt_r, php's implemetation is used (all algo and TS), php can't be used with unsafe crypt anymore
   - if one algo is missing, php's implemetation is used
   - Windows always use php's implementation
 - removed old code in windows/
2008-07-28 11:50:35 +00:00