@@ -338,6 +338,8 @@ function phpseclib_mcrypt_module_open($algorithm, $algorithm_directory, $mode, $
338
338
339
339
$ cipher ->disablePadding ();
340
340
341
+ $ cipher ->key = null ;
342
+
341
343
return $ cipher ;
342
344
}
343
345
@@ -677,7 +679,6 @@ function phpseclib_mcrypt_generic_init(Base $td, $key, $iv)
677
679
phpseclib_set_iv ($ td , $ iv );
678
680
679
681
$ td ->enableContinuousBuffer ();
680
- $ td ->mcrypt_polyfill_init = true ;
681
682
682
683
return 0 ;
683
684
}
@@ -699,7 +700,7 @@ function phpseclib_mcrypt_generic_helper(Base $td, &$data, $op)
699
700
// Warning: mcrypt_generic(): supplied resource is not a valid MCrypt resource
700
701
// that error doesn't really make a lot of sense in this context since $td is not a resource nor should it be one.
701
702
// in light of that we'll just display the same error that you get when you don't call mcrypt_generic_init() at all
702
- if (!isset ($ td ->mcrypt_polyfill_init )) {
703
+ if (!isset ($ td ->key )) {
703
704
trigger_error ('m ' . $ op . '_generic(): Operation disallowed prior to mcrypt_generic_init(). ' , E_USER_WARNING );
704
705
return false ;
705
706
}
@@ -775,13 +776,13 @@ function phpseclib_mdecrypt_generic(Base $td, $data)
775
776
*/
776
777
function phpseclib_mcrypt_generic_deinit (Base $ td )
777
778
{
778
- if (!isset ($ td ->mcrypt_polyfill_init )) {
779
+ if (!isset ($ td ->key )) {
779
780
trigger_error ('mcrypt_generic_deinit(): Could not terminate encryption specifier ' , E_USER_WARNING );
780
781
return false ;
781
782
}
782
783
783
784
$ td ->disableContinuousBuffer ();
784
- unset( $ td ->mcrypt_polyfill_init ) ;
785
+ $ td ->key = null ;
785
786
return true ;
786
787
}
787
788
@@ -796,7 +797,7 @@ function phpseclib_mcrypt_generic_deinit(Base $td)
796
797
*/
797
798
function phpseclib_mcrypt_module_close (Base $ td )
798
799
{
799
- //unset( $td->mcrypt_polyfill_init) ;
800
+ $ td ->key = null ;
800
801
return true ;
801
802
}
802
803
0 commit comments