Hello,
here is the patch.
Derick
On 25 Dec 2001 [EMAIL PROTECTED] wrote:
> ID: 14691
> User updated by: [EMAIL PROTECTED]
> Reported By: [EMAIL PROTECTED]
> Status: Closed
> Bug Type: mcrypt related
> Operating System: Linux
> PHP Version: 4.1.0
> New Comment:
>
> �an you send me patch ?
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2001-12-25 11:31:53] [EMAIL PROTECTED]
>
>
> Fixed in CVS, this will be in 4.1.1
>
> Derick
>
> ------------------------------------------------------------------------
>
> [2001-12-25 10:07:51] [EMAIL PROTECTED]
>
> <pre>
> <?
> $secret_key = "this is a very secret key this is a very secret key this is a
>very secret key" ;
> $input = "Let us meet at 9 o'clock at the secret place.";
>
> $modes = mcrypt_list_modes ();
>
> foreach(mcrypt_list_algorithms() as $cipher)
> {
> $cipher_name = mcrypt_get_cipher_name($cipher);
>
> echo "<b>$cipher_name ($cipher)</b>";
>
> echo " (self test: ";
> echo (mcrypt_module_self_test($cipher)) ? 'OK' : 'Error';
> echo ")<hr>\n";
>
> if ($cipher_name)
> {
> $mode_list = mcrypt_list_modes();
>
> while(list(,$mode) = each($mode_list))
> {
> $iv_size = @mcrypt_get_iv_size ($cipher, $mode);
> $iv = @mcrypt_create_iv ($iv_size,MCRYPT_RAND);
>
> $td = @mcrypt_module_open ($cipher, "", $mode, "");
>
> echo "mcrypt_module_open ($cipher, \"\", $mode, \"\")
>- ";
> if (!$td){
> echo "failed";
> }else{
> echo "ok";
> if (@mcrypt_generic_init($td, $key, $iv) != -1)
> {
> $c_t = mcrypt_generic ($td, $input);
> @mcrypt_generic_init ($td, $key, $iv);
> $p_t = mdecrypt_generic ($td, $c_t);
> }
>
> echo "(mdecrypt|mcrypt)_generic)$mode): ";
> if (strncmp ($p_t, $input, strlen($input)) == 0)
> echo "ok";
> else
> echo "error";
>
> echo "\n";
> }
> echo "\n\n";
> }
> }
> }
> ?>
>
>
> (gdb) run -f new.php
> Starting program: /export/work/php-4.1.1/./php -f new.php
> <pre>
> <b>Twofish (twofish)</b> (self test: OK)<hr>
> mcrypt_module_open (twofish, "", ofb, "") - ok
> Program received signal SIGSEGV, Segmentation fault.
> 0x40017c34 in ofb_LTX__mcrypt (buf=0x0, plaintext=0x83ce5ec, len=45, blocksize=16,
>akey=0x0,
> func=0x425eea30 <twofish_LTX__mcrypt_encrypt>, func2=0x425ef59c
><twofish_LTX__mcrypt_decrypt>) at ofb.c:114
> 114 memmove(buf->enc_s_register, buf->s_register, blocksize);
> (gdb) bt
> #0 0x40017c34 in ofb_LTX__mcrypt (buf=0x0, plaintext=0x83ce5ec, len=45,
>blocksize=16, akey=0x0,
> func=0x425eea30 <twofish_LTX__mcrypt_encrypt>, func2=0x425ef59c
><twofish_LTX__mcrypt_decrypt>) at ofb.c:114
> #1 0x4023d47d in mcrypt_enc_get_algorithms_name () at mcrypt_modules.c:367
> #2 0x4023c741 in mcrypt_generic (td=0x83cc2c0, plaintext=0x83ce5ec, len=45) at
>mcrypt.c:165
> #3 0x0814c185 in zif_mcrypt_generic (ht=2, return_value=0x83cc264, this_ptr=0x0,
>return_value_used=1) at mcrypt.c:566
> #4 0x081aae6a in execute (op_array=0x83c1e8c) at ./zend_execute.c:1590
> #5 0x080e5239 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at
>zend.c:814
> #6 0x080801c1 in php_execute_script (primary_file=0xbffff7f0) at main.c:1307
> #7 0x0807a8cc in main (argc=3, argv=0xbffff864) at cgi_main.c:738
> #8 0x404f19cb in __libc_start_main (main=0x8079f34 <main>, argc=3, argv=0xbffff864,
>init=0x8076e1c <_init>,
> fini=0x82310d0 <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, stack_end=0xbffff85c)
>at ../sysdeps/generic/libc-start.c:92
>
> ------------------------------------------------------------------------
>
>
>
> Edit this bug report at http://bugs.php.net/?id=14691&edit=1
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Index: mcrypt.c
===================================================================
RCS file: /repository/php4/ext/mcrypt/mcrypt.c,v
retrieving revision 1.57.2.10
retrieving revision 1.57.2.12
diff -u -r1.57.2.10 -r1.57.2.12
--- mcrypt.c 17 Dec 2001 20:23:38 -0000 1.57.2.10
+++ mcrypt.c 25 Dec 2001 16:35:41 -0000 1.57.2.12
@@ -478,7 +478,6 @@
if (Z_STRLEN_PP(key) == 0) {
php_error (E_WARNING, "key size is 0");
- RETURN_FALSE;
}
key_s = emalloc (Z_STRLEN_PP(key));
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]