php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3981 PHP fails to properly detect mcrypt ciphers
Submitted: 2000-03-30 10:22 UTC Modified: 2000-04-01 23:26 UTC
From: vorlon at dodds dot net Assigned:
Status: Closed Package: Compile Failure
PHP Version: 3.0.15 OS: RH 6.1/Linux 2.2/glibc 2.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vorlon at dodds dot net
New email:
PHP Version: OS:

 

 [2000-03-30 10:22 UTC] vorlon at dodds dot net
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-04-01 23:26 UTC] sas at cvs dot php dot net
Don't blame us when other people change their APIs.

libmcrypt 2.2.6 is known to work out of the box.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Jul 09 07:00:01 2026 UTC