mcrypt error

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Hello.

Sometimes I got the following error in my error_log:

PHP Warning: mcrypt_decrypt(): Received initialization vector of size 5, but size 16 is required for this encryption mode in /home/brfiles/public_html/core/includes/file.class.php on line 2297


Does anyone knows how to fix it?
 

sukhman21

Member
YetiShare User
YetiShare Supporter
Jan 26, 2015
508
3
18
not sure what encryption type your mcrypt is using but i have AES256 (AES-256-CBC), never seen this error myself.. maybe try this ?? Not tested. maybe try it on a test server - just to make sure it doesn't break login/upload process..
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
enricodias4654 said:
Hello.

Sometimes I got the following error in my error_log:

PHP Warning: mcrypt_decrypt(): Received initialization vector of size 5, but size 16 is required for this encryption mode in /home/brfiles/public_html/core/includes/file.class.php on line 2297


Does anyone knows how to fix it?
Are you running 5.6.0?
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
5.6 no longer silently accepts invalid iv sizes, hence the warning. See the changelog here:

http://php.net/manual/en/function.mcrypt-encrypt.php

It'll still work fine, but not ideal with the warning.

My line numbers are different but I assume it's this code:

Code:
$ivSize    = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$iv        = mcrypt_create_iv($ivSize, MCRYPT_RAND);
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, md5($key), $pageNumber, MCRYPT_MODE_CBC, $iv);
The $ivSize is what I'm guessing in reverting to 5, I'm not entirely sure why at the moment as it should be returned by PHP using mcrypt_get_iv_size()