Edit report at http://bugs.php.net/bug.php?id=49561&edit=1
ID: 49561 Updated by: [email protected] Reported by: [email protected] Summary: mcrypt warns about having no IV in ECB mode -Status: Verified +Status: Wont fix Type: Bug Package: mcrypt related Operating System: * PHP Version: 5.2.10 New Comment: No upstream activity since years. Previous Comments: ------------------------------------------------------------------------ [2009-09-21 12:26:52] [email protected] Filed bug: https://sourceforge.net/tracker/?func=detail&aid=2863450&group_id=87941&atid=584893 ------------------------------------------------------------------------ [2009-09-20 18:17:57] [email protected] 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' } ------------------------------------------------------------------------ [2009-09-15 12:58:34] [email protected] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=49561&edit=1
