php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49561 mcrypt warns about having no IV in ECB mode
Submitted: 2009-09-15 12:58 UTC Modified: 2010-05-19 16:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: terrafrost@php.net Assigned:
Status: Wont fix Package: mcrypt related
PHP Version: 5.2.10 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: terrafrost@php.net
New email:
PHP Version: OS:

 

 [2009-09-15 12:58 UTC] terrafrost@php.net
Description:
------------
mcrypt complains about their being no IV even if ECB mode is being used.  Since ECB mode doesn't use IVs, it seems like no such warning should be produced.

Bug #43143 is fairly similar to this one, except that that one produced a slightly different error.  Also, that one was closed on the basis that it had been fixed.

Reproduce code:
---------------
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
mcrypt_generic_init($td, 'aaaaaaaaaaaaaaaa', '');
?>

Expected result:
----------------
I would expect that to just run its course and output nothing.

Actual result:
--------------
I get the following:

Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 0, needed: 16 in C:\php\test.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-20 18:17 UTC] sjoerd@php.net
I think this is a bug in mcrypt. The libmcrypt function mcrypt_enc_get_iv_size returns 16 for ECB. The manual says: "If it is ?0? then the IV is ignored in that algorithm," which implies that mcrypt_enc_get_iv_size should return 0 when the mode is ECB.

C-code example:

#include "mcrypt.h"
#include <stdio.h>

int main()
{
	MCRYPT td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, NULL, MCRYPT_ECB, NULL);
	printf("IV size for ECB: %d\n", mcrypt_enc_get_iv_size(td)); // prints '16'
}
 [2010-05-19 16:15 UTC] mike@php.net
-Status: Verified +Status: Wont fix
 [2010-05-19 16:15 UTC] mike@php.net
No upstream activity since years.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC