crash when IV is not set

Bug #21039 crash when IV is not set
Submitted: 2002-12-16 02:27 UTC Modified: 2002-12-16 03:09 UTC
From: mbretter@php.net Assigned:
Status: Closed Package: mcrypt related
PHP Version: 4.3.0RC3 OS: FreeBSD 4.7
Private report: No CVE-ID: None

 [2002-12-16 02:27 UTC] mbretter@php.net

I'm running FreeBSD 4.7 with libmcrypt 2.5.3.

There seems to be a bug in libmcrypt, the crash occurs if you call mcrypt_generic(), but without valid IV. Here's a short script:

$td = mcrypt_module_open ('des', '', 'cbc', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
mcrypt_generic_init ($td, substr($nthash, 0, 7));
$res = mcrypt_generic ($td, $challenge);

changing: 
mcrypt_generic_init ($td, substr($nthash, 0, 7));
to:
mcrypt_generic_init ($td, substr($nthash, 0, 7), $iv);
solves the problem :-)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2002-12-16 02:44 UTC] iliaa@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

libmcrypt author has already been contacted with the fix to the problem.

 [2002-12-16 02:45 UTC] derick@php.net

WTF? This is a bug, and I just fixed it. About to commit it to CVS.

Derick

 [2002-12-16 03:09 UTC] derick@php.net

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.