|  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
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: Assigned:
Status: Wont fix Package: mcrypt related
PHP Version: 5.2.10 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2009-09-15 12:58 UTC]
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:
$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-20 18:17 UTC]
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]
-Status: Verified +Status: Wont fix
 [2010-05-19 16:15 UTC]
No upstream activity since years.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 00:01:28 2024 UTC