Seems the nice folks at SuSe complied libmcrypt for SuSe 7.1 with posix threads enabled so Ive been trying to recompile it with threads disabled (as advised by the docs on php.net). (I was getting crashes)
It compiles fine, but the encryption/decryption algorythims dont seem to work properly. Im encrypting a test string with cbc/blowfish, then using bin2hex to convert it to a string of hex digits using a function thats known to work. To reverse, I convert the hex string back to binary using a hex2bin function supplied in the same known working code, then decrypt with cbc/blowfish.
What I end up getting back is 8 bytes of aparrent garbage at the beginning overwriting the test string followed by the remainder of the test string properly decrypted. It does this for all algorythims I tested.
I also tried it without the hex conversion, encrypting to a binary string then decrypting that directly - same result.
It works fine if I encrypt/decrypt using the mcrypt program in linux, so its somehting to do with the PHP implementation.
Compiled libmcrypt with the usual ./configure --disable-posix-threads, make install, then restarted apache/mod_php4
Linux 2.4.8
PHP 4.0.4pl1
Libmcrypt 2.4.7
What am I missing??