mcrypt hanging during encryption process

Bug #130181 reported by Simon Hayward on 2007-08-03
Affects Status Importance Assigned to Milestone
php-mcrypt (Ubuntu)

Bug Description

Ubuntu 7.04 x86

Using mcrypt in ECB mode, and passing the IV size to the mcrypt_generic_init function, the encryption process hangs intermittently, sometimes for up to 10-12 seconds.

$td = mcrypt_module_open('tripledes, '', 'ecb', '') ;
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_DEV_RANDOM);
$expected_key_size = mcrypt_enc_get_key_size($td);
$encString = substr(md5('enc_string'), 0, $expected_key_size);
mcrypt_generic_init($td, $encString, $iv);

It was noticed that IV is ignored in ECB, so $iv was set to a zero integer and performance times returned to normal.

Jay Pipes (jaypipes) wrote :

Hi! We use mcrypt and php on Ubuntu 7.10 server for our MySQL Forge ( is a staging domain). We've noticed this same bug as well, and it cripples the website when it strikes. I notice that about 1 out of every ten invocations of the mcrypt library will hang and the Apache process gets zombied. Here is a test page I've been using. On my localhost, everything works well. On the production server, about one in every 10 page requests seems to hang:

The code is almost identical as the original poster's code, but wrapped in a class... if someone could advise on specific tests or output I could provide, I would be happy to do so, but I'm currently drawing a blank as to how to track down the source of this issue...

Thanks much!


Jay Pipes (jaypipes) wrote :

FYI, I've found that using PEAR's Crypt_Blowfish class is a viable workaround. Haven't investigated what the differences are between that class and calling mcrypt_ directly, but it fixes the issues...

Daniel T Chen (crimsun) wrote :

Is this symptom still reproducible with 5.2.6 in 8.10 beta or later?

Changed in php-mcrypt:
status: New → Incomplete
Javier Jardón (jjardon) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in php-mcrypt:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers