From: taomyn at myway dot com Operating system: Windows Server 2003 PHP version: 4.3.5 PHP Bug Type: mcrypt related Bug description: Decrypt routines not working as pre v4.3.4
Description: ------------ My decrypting routines now fail to decrypt and in fact seem to return the encrypted value. Reproduce code: --------------- function encrypt_pwd($password) { /* Return encrypted password */ global $config; $password = trim($password); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $key = mhash(MHASH_MD5,substr($config['pass_phrase'], 0, mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB))); error_log("EP===".$password."==="); error_log("EK===".$key."==="); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc_pwd = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $password, MCRYPT_MODE_ECB, $iv); error_log("EE===".$enc_pwd."==="); return $enc_pwd; } function decrypt_pwd($password) { /* Return decrypted password */ global $config; $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $key = mhash(MHASH_MD5,substr($config['pass_phrase'], 0, mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB))); error_log("DP===".$password."==="); error_log("DK===".$key."==="); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $dec_pwd = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $password, MCRYPT_MODE_ECB, $iv); error_log("DD===".trim(chop($dec_pwd))."==="); return trim(chop($dec_pwd)); } Expected result: ---------------- [29-Mar-2004 09:35:31] EP===bubbles10=== [29-Mar-2004 09:35:31] EK===-ñ ãWqG9î„\6‚=== [29-Mar-2004 09:35:31] EE===u!‚ž+½_Yi«¡Oât=== [29-Mar-2004 09:35:50] DP===u!‚ž+½_Yi«¡Oât=== [29-Mar-2004 09:35:50] DK===-ñ ãWqG9î„\6‚=== [29-Mar-2004 09:35:50] DD===bubbles10=== Actual result: -------------- [29-Mar-2004 09:35:31] EP===bubbles10=== [29-Mar-2004 09:35:31] EK===-ñ ãWqG9î„\6‚=== [29-Mar-2004 09:35:31] EE===u!‚ž+½_Yi«¡Oât=== [29-Mar-2004 09:35:50] DP===u!‚ž+½_Yi«¡Oât=== [29-Mar-2004 09:35:50] DK===-ñ ãWqG9î„\6‚=== [29-Mar-2004 09:35:50] DD===u!‚ž+½_Yi«¡Oât=== -- Edit bug report at http://bugs.php.net/?id=27746&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27746&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27746&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27746&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27746&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27746&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27746&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27746&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27746&r=support Expected behavior: http://bugs.php.net/fix.php?id=27746&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27746&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27746&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27746&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27746&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27746&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27746&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27746&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27746&r=float