mcrypt core dumping

Mark Nenadov marknenadov at winningteam.com
Mon Feb 25 15:05:37 EST 2002


Is anyone out there using the Python mcrypt module?

I am using mcrypt and every third or fourth time I run my program I get a
segmentation fault (core dump).  I have narrowed it down to the line that
calls mcrypt_generic(). The following is the function that I
made:

from mcrypt import *

def mcrypt_encode( text, passcode ):
	cipher = "tripledes"
	key_size = mcrypt_module_get_algo_key_size( cipher, genNULL() )
	key = gen_key( key_size, passcode, len(passcode))
	
	module = mcrypt_module_open( cipher, genNULL(), "cfb", genNULL() )
	mcrypt_generic_init( module, key, key_size, gen_iv( module ) )
	
	buffer = mkbuffer( text )
	
        #this is the line that appears to be causing the core dump
        mcrypt_generic( module, buffer, len( buffer ) )
	ctext = getbuffer( buffer, len( buffer ) )

	mcrypt_free( buffer )	
	mcrypt_generic_end( module )
	mcrypt_module_close( module )
	mcrypt_free( key )
		
	return ctext	


Is there anything wrong with that? Anybody have any clues as to what may
be causing this?

~Mark Nenadov



More information about the Python-list mailing list