Пример #1
0
__u32 TFDecode(HTF hTF, void * ibuf, uint len, void * obuf)
{
	TWI	*twi = (TWI	*)hTF;
    //decode data
	uint left_len = len;
	uint this_len = 0;
	uint offset_len = 0;
	unsigned char  *iaddr, *oaddr;

    iaddr = (unsigned char *)ibuf;
    oaddr = (unsigned char *)obuf;
	//逐个分组进行处理
	while(left_len > 0)
	{
		this_len = (left_len > TF_SIZE)? (TF_SIZE) : (left_len);
		twofish_new_decrypt(twi, (uint *)(iaddr +  offset_len), (uint *)(oaddr + offset_len));
        offset_len += this_len;
		left_len -= this_len;
	}

	return 0;
}
__u32 TFDecode(HTF hTF, void * ibuf, __u32 len, void * obuf)
{
	TWI	*twi = (TWI	*)hTF;
    //decode data
	__u32 left_len = len;
	__u32 this_len = 0;
	__u32 offset_len = 0;
	__u8  *iaddr, *oaddr;

    iaddr = (__u8 *)ibuf;
    oaddr = (__u8 *)obuf;
	//逐个分组进行处理
	while(left_len > 0)
	{
		this_len = (left_len > TF_SIZE)? (TF_SIZE) : (left_len);
		twofish_new_decrypt(twi, (__u32 *)(iaddr +  offset_len), (__u32 *)(oaddr + offset_len));
        offset_len += this_len;
		left_len -= this_len;
	}

	return 0;
}