From:             yu at csh dot dp dot ua
Operating system: Windows 2000
PHP version:      4.3.4
PHP Bug Type:     mcrypt related
Bug description:  mdecrypt_generic() doesn't decrypt anything

Description:
------------
Server is localhost.
Function mdecrypt_generic() doesn't decrypt anything.
Instead it returns value of the encrypted string without changing.
Crypt-library loaded from
http://ftp.emini.dk/pub/php/win32/mcrypt/libmcrypt.dll , as specified in
the php_manual for mcrypt functions.

Same problem reports other users:
http://bugs.php.net/bug.php?id=3165&edit=2 - Bug #3165: encrypt/decrypt
not a function?
http://www.forbiddenweb.org/viewtopic.php?t=4556

here is another link to crypt-libraries, that point as functional:
http://ftp.proventum.net/pub/php/win32/misc/mcrypt/ 
, but i don't check it functionality.


Additionaly mcrypt_create_iv() produces same iv for every time script is
runing. But this not problem when, for example, 
<? 
...
$iv=substr(pack('h*',sha1(uniqid(rand())), 0,
mcrypt_enc_get_iv_size($td)); 
...
?>


Reproduce code:
---------------
<?php 
#Example to mcrypt_module_open() from php_manual_ru.html
#almost without changes
srand();
$td = mcrypt_module_open('rijndael-256', '', 'cbc', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
$ks = mcrypt_enc_get_key_size($td);
$key = substr(md5('very secret key'), 0, $ks);
mcrypt_generic_init($td, $key, $iv);
$encrypted = mcrypt_generic($td, 'This is my data');
mcrypt_generic_deinit($td);
mcrypt_generic_init($td, $key, $iv);
$decrypted = mdecrypt_generic($td, $encrypted);
mcrypt_generic_deinit($td);    
mcrypt_module_close($td);   
echo trim($decrypted) . "\n";?>

Expected result:
----------------
"This is my data"

Actual result:
--------------
$encrypted value

-- 
Edit bug report at http://bugs.php.net/?id=27062&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27062&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27062&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27062&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27062&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27062&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27062&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27062&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27062&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27062&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27062&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27062&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27062&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27062&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27062&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27062&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27062&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27062&r=float

Reply via email to