joey Tue, 23 Feb 2010 20:53:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295440
Log: Rename crypt_blowfish_invalid_rounds.phpt to crypt_blowfish_variation1.phpt to follow phpt naming conventions. Added SKIPIF test to crypt_blowfish_variation1.phpt Added crypt_blowfish_variation2.phpt, which tests the DES-fallback as when blowfish salt is missing rounds. Changed paths: D php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt A + php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation1.phpt (from php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt:r295436) A php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation2.phpt Deleted: php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt 2010-02-23 20:40:03 UTC (rev 295439) +++ php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt 2010-02-23 20:53:58 UTC (rev 295440) @@ -1,31 +0,0 @@ ---TEST-- -Test Blowfish crypt() with invalid rounds ---FILE-- -<?php - -$salts = array(b'32' => b'$2a$32$CCCCCCCCCCCCCCCCCCCCCC$', - b'33' => b'$2a$33$CCCCCCCCCCCCCCCCCCCCCC$', - b'34' => b'$2a$34$CCCCCCCCCCCCCCCCCCCCCC$', - b'35' => b'$2a$35$CCCCCCCCCCCCCCCCCCCCCC$', - b'36' => b'$2a$36$CCCCCCCCCCCCCCCCCCCCCC$', - b'37' => b'$2a$37$CCCCCCCCCCCCCCCCCCCCCC$', - b'38' => b'$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',); - -foreach($salts as $i=>$salt) { - $crypt = crypt(b'U*U', $salt); - if ($crypt === b'*0' || $crypt === b'*1') { - echo "$i. OK\n"; - } else { - echo "$i. Not OK\n"; - } -} - -?> ---EXPECT-- -32. OK -33. OK -34. OK -35. OK -36. OK -37. OK -38. OK Copied: php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation1.phpt (from rev 295436, php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt) =================================================================== --- php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation1.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation1.phpt 2010-02-23 20:53:58 UTC (rev 295440) @@ -0,0 +1,37 @@ +--TEST-- +Test Blowfish crypt() with invalid rounds +--SKIPIF-- +<?php +if (!function_exists('crypt') || !defined("CRYPT_BLOWFISH")) { + die("SKIP crypt()-blowfish is not available"); +} +?> +--FILE-- +<?php + +$salts = array(b'32' => b'$2a$32$CCCCCCCCCCCCCCCCCCCCCC$', + b'33' => b'$2a$33$CCCCCCCCCCCCCCCCCCCCCC$', + b'34' => b'$2a$34$CCCCCCCCCCCCCCCCCCCCCC$', + b'35' => b'$2a$35$CCCCCCCCCCCCCCCCCCCCCC$', + b'36' => b'$2a$36$CCCCCCCCCCCCCCCCCCCCCC$', + b'37' => b'$2a$37$CCCCCCCCCCCCCCCCCCCCCC$', + b'38' => b'$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',); + +foreach($salts as $i=>$salt) { + $crypt = crypt(b'U*U', $salt); + if ($crypt === b'*0' || $crypt === b'*1') { + echo "$i. OK\n"; + } else { + echo "$i. Not OK\n"; + } +} + +?> +--EXPECT-- +32. OK +33. OK +34. OK +35. OK +36. OK +37. OK +38. OK Added: php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation2.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation2.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/strings/crypt_blowfish_variation2.phpt 2010-02-23 20:53:58 UTC (rev 295440) @@ -0,0 +1,14 @@ +--TEST-- +Test Blowfish crypt() falls back to DES when rounds are not specified, +or Blowfish is not available. +--FILE-- +<?php +$crypt = crypt(b'U*U', b'$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW'); +if ($crypt===b'$2SHYF.wPGyfE') { + echo "OK\n"; +} else { + echo "Not OK\n"; +} +?> +--EXPECT-- +OK
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php