/******************************************************************************
版权所有：	
文件名称：	gh_sm2_dev.h
文件版本：	01.01
创建作者:		xxxxxx
创建日期：	2014.7.23
功能说明：	加密接口.

其它说明：
修改记录：
*/
#ifndef _GH_SM2_DEV_H
#define	_GH_SM2_DEV_H

//主设备号
#ifndef GH_SM2_DEV_MAJOR
#define GH_SM2_DEV_MAJOR			239
#endif

 

//设备节点名
#ifndef GH_VS_DEV0	
#define	GH_VS_DEV0				"/dev/gh_sm2_dev"	
#endif

//readUserId,writeUserId函数参数数据结构
typedef struct _Twr_UserId{
	unsigned char *dat;	
}Twr_UserId;	


//readSM2key,writeSM2key函数参数数据结构
typedef struct _Twr_SM2key{
	unsigned char no;
	unsigned char *dat;
}Twr_SM2key;


//SM2_GenerateRandom_me函数参数数据结构
typedef struct _TSM2_GenerateRandom_me{
	unsigned int uiLength;
	unsigned char *pucRandom;
}TSM2_GenerateRandom_me;

//encrypt_epri函数参数数据结构
typedef struct _Tencrypt_epri{
	unsigned char *in;
 	unsigned int in_len;
 	unsigned char *out;
 	unsigned int *out_len; 
 	unsigned int key; 
 	int type;
}Tencrypt_epri;


//SM2_Encrypt函数参数数据结构
typedef struct _TSM2_Encrypt{
	unsigned char *pucDataInput;
	unsigned int  uiInputLength;
	ECCrefPublicKey *pucPublicKey; 
	unsigned char *pucRandom;
	unsigned int uiRandomLength; 
	ECCCipher *pucEncData;
}TSM2_Encrypt;

//SM2_Verify函数参数数据结构
typedef struct _TSM2_Verify{
	unsigned char *pucDataInput;
	unsigned int  uiInputLength;
	unsigned char *pucID;
	unsigned int uiIDLength;
	ECCrefPublicKey *pucPublicKey;
	ECCSignature *pucSignature;
}TSM2_Verify;


//魔数
#define CFG_IOCTL_GH_SM2_DEV_TYPE	0xF3

#define GH_SM2_DEV_READUSERID				_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 1, Twr_UserId)	
#define GH_SM2_DEV_WRITEUSERID			_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 2, Twr_UserId)	
#define GH_SM2_DEV_READSM2KEY				_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 3, Twr_SM2key)	
#define GH_SM2_DEV_WRITESM2KEY			_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 4, Twr_SM2key)	
#define GH_SM2_DEV_SM2_GENERATERANDOM_ME	_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 5, TSM2_GenerateRandom_me)	
#define GH_SM2_DEV_ENCRYPTE_EPRI		_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 6, Tencrypt_epri)	
#define GH_SM2_DEV_SM2_ENCRYPT			_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 7, TSM2_Encrypt)	
#define GH_SM2_DEV_SM2_VERIFY				_IOW(CFG_IOCTL_GH_SM2_DEV_TYPE, 8, TSM2_Verify)	
#endif /* GOOSE_DRV_H */
