Re: cvs: php4 /ext/mcrypt mcrypt.c
| From: | derick@php.net | Date: | Sun, 16 Jun 2002 18:26:07 +0000 |
| Subject: | Re: cvs: php4 /ext/mcrypt mcrypt.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-12379@lists.php.net to get a copy of this message | ||
On Sun, 16 Jun 2002, Derick Rethans wrote:
> derick Sun Jun 16 14:20:22 2002 EDT
>
> Modified files:
> /php4/ext/mcrypt mcrypt.c
> Log:
> - Fix version in phpinfo();
+ converting mcrypt_module_open to use zend_parse_parameters (That was
still in my local source it seems :)
Derick
> Index: php4/ext/mcrypt/mcrypt.c
> diff -u php4/ext/mcrypt/mcrypt.c:1.75 php4/ext/mcrypt/mcrypt.c:1.76
> --- php4/ext/mcrypt/mcrypt.c:1.75 Thu Feb 28 07:10:35 2002
> +++ php4/ext/mcrypt/mcrypt.c Sun Jun 16 14:20:21 2002
> @@ -16,7 +16,7 @@
> | Derick Rethans <d.rethans@jdimedia.nl> |
> +----------------------------------------------------------------------+
> */
> -/* $Id: mcrypt.c,v 1.75 2002/02/28 12:10:35 yohgaki Exp $ */
> +/* $Id: mcrypt.c,v 1.76 2002/06/16 18:20:21 derick Exp $ */
>
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> @@ -391,7 +391,7 @@
> php_info_print_table_row(2, "version", "2.2.x");
> #endif
> #if HAVE_LIBMCRYPT24
> - php_info_print_table_row(2, "version", "2.4.x");
> + php_info_print_table_row(2, "version", ">= 2.4.x");
> php_info_print_table_row(2, "Supported ciphers", tmp1.c);
> php_info_print_table_row(2, "Supported modes", tmp2.c);
> smart_str_free (&tmp1);
> @@ -414,23 +414,22 @@
> Opens the module of the algorithm and the mode to be used */
> PHP_FUNCTION(mcrypt_module_open)
> {
> - zval **cipher, **cipher_directory, **mode, **mode_directory;
> - MCRYPT td;
> - int argc;
> -
> - argc = ZEND_NUM_ARGS();
> - MCRYPT_CHECK_PARAM_COUNT (4,4)
> + char *cipher, *cipher_dir;
> + char *mode, *mode_dir;
> + int cipher_len, cipher_dir_len;
> + int mode_len, mode_dir_len;
> + MCRYPT td;
> +
> + if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss",
> + &cipher, &cipher_len, &cipher_dir, &cipher_dir_len,
> + &mode, &mode_len, &mode_dir, &mode_dir_len)) {
> + return;
> + }
>
> - zend_get_parameters_ex(4, &cipher, &cipher_directory, &mode,
> &mode_directory);
> - convert_to_string_ex(cipher);
> - convert_to_string_ex(cipher_directory);
> - convert_to_string_ex(mode);
> - convert_to_string_ex(mode_directory);
> -
> - td = mcrypt_module_open (Z_STRVAL_PP(cipher),
> - Z_STRLEN_PP(cipher_directory) > 0 ? Z_STRVAL_PP(cipher_directory) : MCG(algorithms_dir),
> - Z_STRVAL_PP(mode),
> - Z_STRLEN_PP(mode_directory) > 0 ? Z_STRVAL_PP(mode_directory) : MCG(modes_dir));
> + td = mcrypt_module_open (cipher,
> + cipher_dir_len > 0 ? cipher_dir : MCG(algorithms_dir),
> + mode,
> + mode_dir_len > 0 ? mode_dir : MCG(modes_dir));
>
> if (td == MCRYPT_FAILED) {
> php_error (E_WARNING, "could not open encryption module");
> @@ -837,8 +836,7 @@
>
> if (mcrypt_module_self_test (module, dir) == 0) {
> RETURN_TRUE;
> - }
> - else {
> + } else {
> RETURN_FALSE;
> }
> }
> @@ -916,7 +914,7 @@
> This function decrypts the crypttext */
> PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
> {
> - int argc, i, count;
> + int i, count;
> int *key_sizes;
>
> MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
---------------------------------------------------------------------------
Did I help you? http://www.jdimedia.nl/derick/link.php?url=giftlist
Frequent ranting: http://www.jdimedia.nl/derick/
---------------------------------------------------------------------------
PHP: Scripting the Web - derick@php.net
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---------------------------------------------------------------------------