ID:               49561
 Updated by:       sjo...@php.net
 Reported By:      terrafr...@php.net
 Status:           Open
 Bug Type:         mcrypt related
 Operating System: *
 PHP Version:      5.2.10
 New Comment:

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'
}


Previous Comments:
------------------------------------------------------------------------

[2009-09-15 12:58:34] terrafr...@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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49561&edit=1

Reply via email to