|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 02:00:02 2025 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' }