summaryrefslogtreecommitdiff
path: root/ext/mcrypt/mcrypt.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-05-01 11:14:22 +0000
committerSascha Schumann <sas@php.net>1999-05-01 11:14:22 +0000
commit8baa86ed515469788e28c16aea4f80029078d03b (patch)
treed72c62d270c6d485828e90b4724f0f98e679d840 /ext/mcrypt/mcrypt.c
parent064f75fd1b11f42431a2118289e211fa9afe267e (diff)
downloadphp-git-8baa86ed515469788e28c16aea4f80029078d03b.tar.gz
mcrypt 2.1.18 support, better autoconf checking
Diffstat (limited to 'ext/mcrypt/mcrypt.c')
-rw-r--r--ext/mcrypt/mcrypt.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 79bd4d75c9..500edfd645 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -31,17 +31,12 @@
#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) {