]> granicus.if.org Git - php/commitdiff
mcrypt 2.1.18 support, better autoconf checking
authorSascha Schumann <sas@php.net>
Sat, 1 May 1999 11:14:22 +0000 (11:14 +0000)
committerSascha Schumann <sas@php.net>
Sat, 1 May 1999 11:14:22 +0000 (11:14 +0000)
ext/mcrypt/config.m4
ext/mcrypt/mcrypt.c
ext/mcrypt/php_mcrypt.h

index 78dd7fb49745f1523865624bb092f3c1053d7a2a..b1ff3d465a479442d2cd58a383c171b2d22823d6 100644 (file)
@@ -9,10 +9,14 @@ AC_ARG_WITH(mcrypt,
 [
   if test "$withval" != "no"; then
     for i in /usr/local /usr $withval; do
-      if test -f $i/include/lcrypt.h; then
+      if test -f $i/include/mcrypt.h; then
         MCRYPT_DIR=$i
       fi
     done
+    if test "$MCRYPT_DIR" = ""; then
+      AC_MSG_ERROR(Please install mcrypt.h and libmcrypt.a accordingly to the do
+cumentation - I cannot find mcrypt.h)
+    fi
     INCLUDES="$INCLUDES -I$MCRYPT_DIR/include"
     EXTRA_LIBS="$EXTRA_LIBS -L$MCRYPT_DIR/lib -lmcrypt"
 
index 79bd4d75c931183f413ac2e78c31a69f5ab41bd9..500edfd645a88d15531b0fd3769af891bc34cc67 100644 (file)
 
 #if HAVE_LIBMCRYPT
 
-#if PHP_API_VERSION < 19990421
-#define  zend_module_entry php3_module_entry
-#include "modules.h"
-#include "internal_functions.h"
-#endif
-
-#include "fcntl.h"
-
 #include "php_mcrypt.h"
+#include "fcntl.h"
 
-#include "lcrypt.h"
+/* we should find a way to figure out whether RC6/IDEA are available */
+#define NON_FREE
+#include "mcrypt.h"
 
 function_entry mcrypt_functions[] = {
        PHP_FE(mcrypt_ecb, NULL)
@@ -143,15 +138,29 @@ static int php_minit_mcrypt(INIT_FUNC_ARGS)
        MCRYPT_ENTRY(TripleDES);
        MCRYPT_ENTRY(ThreeWAY);
        MCRYPT_ENTRY(GOST);
+#ifdef MCRYPT2
+       MCRYPT_ENTRY(CRYPT);
+       MCRYPT_ENTRY(DES_COMPAT);
+#endif
        MCRYPT_ENTRY(SAFER64);
        MCRYPT_ENTRY(SAFER128);
        MCRYPT_ENTRY(CAST128);
        MCRYPT_ENTRY(TEAN);
-       MCRYPT_ENTRY(TWOFISH);
        MCRYPT_ENTRY(RC2);
-#ifdef CRYPT
-       MCRYPT_ENTRY(CRYPT);
+#ifdef TWOFISH
+       MCRYPT_ENTRY(TWOFISH);
+#elif defined(TWOFISH128)
+       MCRYPT_ENTRY(TWOFISH128);
+       MCRYPT_ENTRY(TWOFISH192);
+       MCRYPT_ENTRY(TWOFISH256);
+#endif
+#ifdef RC6
+       MCRYPT_ENTRY(RC6);
+#endif
+#ifdef IDEA
+       MCRYPT_ENTRY(IDEA);
 #endif
+       
        return SUCCESS;
 }
 
@@ -179,6 +188,11 @@ PHP_FUNCTION(mcrypt_create_iv)
        source = psource->value.lval;
 
        i = size->value.lval;
+       if(i <= 0) {
+               php3_error(E_WARNING, "illegal size input parameter");
+               RETURN_FALSE;
+       }
+       
        iv = ecalloc(i, 1);
        
        if(source == RANDOM || source == URANDOM) {
index 97ca367b7d81e0b076b4f9fd7591a9eb444e1132..5d511a4816e5f445bf51dc8dc2f93dc0f4022945 100644 (file)
@@ -3,6 +3,12 @@
 
 #if HAVE_LIBMCRYPT
 
+#if PHP_API_VERSION < 19990421
+#define  zend_module_entry php3_module_entry
+#include "modules.h"
+#include "internal_functions.h"
+#endif
+
 extern zend_module_entry mcrypt_module_entry;
 #define mcrypt_module_ptr &mcrypt_module_entry