Bug #3981: PHP fails to properly detect mcrypt ciphers
| From: | vorlon at dodds dot net | Date: | Thu, 30 Mar 2000 15:22:45 +0000 |
| Subject: | Bug #3981: PHP fails to properly detect mcrypt ciphers | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17415@lists.php.net to get a copy of this message | ||
From: vorlon@dodds.net
Operating system: RH 6.1/Linux 2.2/glibc 2.1
PHP version: 3.0.15
PHP Bug Type: Compile Failure
Bug description: PHP fails to properly detect mcrypt ciphers
The mcrypt support in PHP 3.0 is difficult to get working, because it depends on a specific version
of libmcrypt but there's no indication in the documentation which version this is. Using
libmcrypt 2.3.4, the build errors out with:
gcc -fPIC -O2 -march=pentiumpro -fno-strength-reduce -DLINUX=2 -DNO_DBM_REWRITEMAP -DMOD_SSL=205100
-DEAPI -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE -I. -I. -I/usr/include/apache
-I/usr/include/freetype -I/usr/include/mysql -I/usr/include/ucd-snmp -c
functions/mcrypt.c -o functions/mcrypt.o
functions/mcrypt.c: In function `php_minit_mcrypt':
functions/mcrypt.c:166: `MCRYPT_RC6_256' undeclared (first use in this function)
functions/mcrypt.c:166: (Each undeclared identifier is reported only once
functions/mcrypt.c:166: for each function it appears in.)
functions/mcrypt.c:168: `MCRYPT_RC6_128' undeclared (first use in this function)
functions/mcrypt.c:169: `MCRYPT_RC6_192' undeclared (first use in this function)
make: *** [functions/mcrypt.o] Error 1
Trying to build with libmcrypt 2.4.0 is even less successful, with very few of the ciphers in
functions/mcrypt.c found in the mcrypt header files.
It would be useful if php would check for a given cipher in mcrypt.h *before* attempting to declare
it as a PHP constant. Here is a short patch which works tfor PHP 3.0.15 with libmcrypt 2.3.4. This
patch should probably be generalized to accomodate other additions or subtractions from the
libmcrypt API.
diff -uNr php-3.0.15-orig/functions/mcrypt.c php-3.0.15/functions/mcrypt.c
--- php-3.0.15-orig/functions/mcrypt.c Fri Dec 31 22:31:16 1999
+++ php-3.0.15/functions/mcrypt.c Thu Mar 30 09:16:09 2000
@@ -163,10 +163,16 @@
MCRYPT_ENTRY2(RIJNDAEL_256);
MCRYPT_ENTRY2(RC2_256);
MCRYPT_ENTRY2(RC2_128);
+#ifdef MCRYPT_RC6_256
MCRYPT_ENTRY2(RC6_256);
+#endif
MCRYPT_ENTRY2(IDEA);
+#ifdef MCRYPT_RC6_128
MCRYPT_ENTRY2(RC6_128);
+#endif
+#ifdef MCRYPT_RC6_192
MCRYPT_ENTRY2(RC6_192);
+#endif
MCRYPT_ENTRY2(RC4);
#else
#error Please update your mcrypt library
Barring this, it would be helpful if the PHP documentation stated clearly *which* version of
libmcrypt is supposed to be used.