Bug #68238 [NEW]: mcrypt_encode tests are broken
| From: | gm dot outside+php at gmail dot com | Date: | Wed, 15 Oct 2014 17:16:28 +0000 |
| Subject: | Bug #68238 [NEW]: mcrypt_encode tests are broken | ||
| Groups: | php.bugs php.qa | ||
| Request: | Send a blank email to php-bugs+get-188119@lists.php.net to get a copy of this message | ||
From: gm dot outside+php at gmail dot com
Operating system: Linux
PHP version: 5.6.1
Package: Testing related
Bug Type: Bug
Bug description:mcrypt_encode tests are broken
Description:
------------
There was a recent commit
(http://git.php.net/?p=php-src.git;a=commit;h=a861a3a93d89a50ce58e1ab1abef1eb501f97483)
that changed behaviour of the mcrypt_encode() function. After that
commit the key is required to be at least the expected key length long,
otherwise a warning message is issued and the mcrypt_encode() routine
returns a failure.
The corresponding test in ext/mcrypt/tests/bug62102_rfc2144.php supplies
10 bytes key instead of 16 for cast-128 80-bit encryption and 5 bytes
key instead of 10 for cast-128 40-bit encryption.
A quick fix to the test would be to pad the keys with '\0' manually
(RFC-2144 B.1), e.g.
mcrypt_encrypt('cast-128',
"\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\0\0\0\0\0\0", $plaintext,
'ecb')
but unfortunately due to the way changed code treats key data (as a null
terminated string) and due to calculating the key size as strlen() of
that string there is no way to satisfy the RFC-2144 B.1 since all
trailing '\0' will be ignored.
Expected result:
----------------
That the RFC-2144 test would be passed with the explicitly specified
vector and that mcrypt_encrypt() would honour the key argument as a
binary string that can include '\0' anywhere in the string.
Actual result:
--------------
All trailing '\0' in the key argument are ignored, therefore it's
impossible to pass RFC-2144 test to match section B.1.
--
Edit bug report at https://bugs.php.net/bug.php?id=68238&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68238&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68238&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68238&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68238&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68238&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68238&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68238&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68238&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68238&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68238&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68238&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68238&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68238&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68238&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68238&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68238&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68238&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68238&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68238&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68238&r=mysqlcfg