Index: Yc_aes.h
===================================================================
--- /YC3121_SDK/fw/crypt/Yc_aes.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/Yc_aes.h	(working copy)
@@ -1,19 +1,18 @@
 #ifndef __YC_AES_H__
 #define __YC_AES_H__
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
 #include "yc_calc.h"
 
-
-#define RET_AES_SUCCESS						(('R'<<24)|('A'<<16)|('S'<<8)|('C'))
-#define RET_AES_FAILURE							(('R'<<24)|('A'<<16)|('F'<<8)|('A'))
-#define RET_AES_KEY_IS_NULL					(('R'<<24)|('A'<<16)|('K'<<8)|('N'))
-#define RET_AES_KEY_IS_OK						(('R'<<24)|('A'<<16)|('K'<<8)|('O'))  
-#define RET_AES_KEY_SIZE_ERROR				(('R'<<24)|('A'<<16)|('K'<<8)|('S'))
-#define RET_AES_PACK_MODE_ERROR				(('R'<<24)|('A'<<16)|('P'<<8)|('E'))
-#define RET_AES_OUTBUF_TOO_SMALL				(('R'<<24)|('A'<<16)|('O'<<8)|('S'))
-#define RET_AES_INPUT_SIZE_ERROR				(('R'<<24)|('A'<<16)|('I'<<8)|('S'))
+#define RET_AES_SUCCESS          (('R'<<24)|('A'<<16)|('S'<<8)|('C'))  //加密成功
+#define RET_AES_FAILURE          (('R'<<24)|('A'<<16)|('F'<<8)|('A'))  //加密失败
+#define RET_AES_KEY_IS_NULL      (('R'<<24)|('A'<<16)|('K'<<8)|('N'))  //密钥为空
+#define RET_AES_KEY_IS_OK        (('R'<<24)|('A'<<16)|('K'<<8)|('O'))  //密钥正确
+#define RET_AES_KEY_SIZE_ERROR   (('R'<<24)|('A'<<16)|('K'<<8)|('S'))  //密钥长度错误
+#define RET_AES_PACK_MODE_ERROR  (('R'<<24)|('A'<<16)|('P'<<8)|('E'))  //分组模式错误
+#define RET_AES_OUTBUF_TOO_SMALL (('R'<<24)|('A'<<16)|('O'<<8)|('S'))  //输出缓冲区不足
+#define RET_AES_INPUT_SIZE_ERROR (('R'<<24)|('A'<<16)|('I'<<8)|('S'))  //输入数据长度错误
 
 #define AES_IV_SIZE	(16)
 
@@ -29,49 +28,46 @@
 /**
   * @method	AES_Enc
   * @brief	AES encrypt function
-  * @param	pack_mode		:block encryption mode ECB or CBC
-  * @param	output			:the pointer of output data buffer
-  * @param	oBytes			:the size of output data buffer
-							("oBytes" must be bigger or equal then "iBytes")
-  * @param	input			:the pointer of input data buffer
-  * @param	iBytes			:the size of input data buffer
-							("iBytes" must be an integer multiple of key length)
-  * @param	key				:AES key
-  * @param	kSize			:the size of AES key: AES_128 AES_192 or AES_256
-  * @param	iv				:initialization vector
-  * @retval					:AES return value
+  * @param	pack_mode :block encryption mode ECB or CBC
+  * @param	output    :the pointer of output data buffer
+  * @param	oBytes    :the size of output data buffer
+	*                   ("oBytes" must be bigger or equal then "iBytes")
+  * @param	input     :the pointer of input data buffer
+  * @param	iBytes    :the size of input data buffer
+  *                   ("iBytes" must be an integer multiple of key length)
+  * @param	key       :AES key
+  * @param	kSize     :the size of AES key: AES_128 AES_192 or AES_256
+  * @param	iv        :initialization vector
+  * @retval AES return value
   */
 
 uint32_t AES_Enc(PACK_ModeTypeDef pack_mode,
-					uint8_t *output, uint32_t obytes,
-					uint8_t *input, uint32_t ibytes,
-					uint8_t *key, AES_KeySizeTypeDef ksize, 
-					AES_IvKeyTypeDef iv,
-					rng_callback f_rng, void *p_rng);
-
-
+                 uint8_t *output, uint32_t obytes,
+                 uint8_t *input, uint32_t ibytes,
+                 uint8_t *key, AES_KeySizeTypeDef ksize, 
+                 AES_IvKeyTypeDef iv,
+                 rng_callback f_rng, void *p_rng);
 
 /**
   * @method	AES_Decrypt
   * @brief	AES decrypt function
-  * @param	pack_mode		:block encryption mode ECB or CBC
-  * @param	output			:the pointer of output data buffer
-  * @param	oBytes			:the size of output data buffer
-							("oBytes" must be bigger or equal then "iBytes")
-  * @param	input			:the pointer of input data buffer
-  * @param	iBytes			:the size of input data buffer
-							("iBytes" must be an integer multiple of key length)
-  * @param	key				:AES key
-  * @param	kSize			:the size of AES key: AES_128 AES_192 or AES_256
-  * @param	iv				:initialization vector
-  * @retval					:AES return value
+  * @param	pack_mode :block encryption mode ECB or CBC
+  * @param	output    :the pointer of output data buffer
+  * @param	oBytes    :the size of output data buffer
+  *                    ("oBytes" must be bigger or equal then "iBytes")
+  * @param	input     :the pointer of input data buffer
+  * @param	iBytes    :the size of input data buffer
+  *                    ("iBytes" must be an integer multiple of key length)
+  * @param	key       :AES key
+  * @param	kSize     :the size of AES key: AES_128 AES_192 or AES_256
+  * @param	iv        :initialization vector
+  * @retval AES return value
   */
 uint32_t AES_Dec(PACK_ModeTypeDef pack_mode,
-					uint8_t *output, uint32_t obytes,
-					uint8_t *input, uint32_t ibytes,
-					uint8_t *key, AES_KeySizeTypeDef ksize, 
-					AES_IvKeyTypeDef iv,
-					rng_callback f_rng, void *p_rng);
+                 uint8_t *output, uint32_t obytes,
+                 uint8_t *input, uint32_t ibytes,
+                 uint8_t *key, AES_KeySizeTypeDef ksize, 
+                 AES_IvKeyTypeDef iv,
+                 rng_callback f_rng, void *p_rng);
  
-
 #endif
Index: yc_calc.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_calc.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_calc.h	(working copy)
@@ -2,11 +2,9 @@
 #define __YC_CALC_H__
 
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
 
-
-
 #define SET_GENKEY     0x0
 #define SET_ENC_DATA1  0x1
 #define SET_ENC_DATA2  0x2
@@ -14,7 +12,6 @@
 #define GET_E_LEN      0x0
 #define GET_FifoBuffer 0x1
 
-
 //struct
 typedef struct
 {
Index: yc_des.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_des.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_des.h	(working copy)
@@ -1,25 +1,24 @@
 #ifndef __YC_DES_H__
 #define __YC_DES_H__
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
 #include "yc_calc.h"
 
+#define RET_DES_SUCCESS            (('R'<<24)|('D'<<16)|('S'<<8)|('C'))  //加密成功
+#define RET_DES_FAILURE            (('R'<<24)|('D'<<16)|('F'<<8)|('A'))  //加密失败
+#define RET_DES_KEY_IS_OK          (('R'<<24)|('D'<<16)|('K'<<8)|('O'))  //密钥正确
+#define RET_DES_KEY_IS_NULL        (('R'<<24)|('D'<<16)|('K'<<8)|('N'))  //密钥指针为空
+#define RET_DES_KEY_CRC_ERROR      (('R'<<24)|('D'<<16)|('K'<<8)|('C'))  //密钥 CRC 错误
+#define RET_DES_KEY_READBACK_ERROR (('R'<<24)|('D'<<16)|('K'<<8)|('R'))  //密钥回读错误
+#define RET_DES_IV_CRC_ERROR       (('R'<<24)|('D'<<16)|('I'<<8)|('C'))  //IVCRC 错误
+#define RET_DES_PACK_MODE_ERROR    (('R'<<24)|('D'<<16)|('P'<<8)|('E'))  //分组模式错误
+#define RET_DES_OUTBUF_TOO_SMALL   (('R'<<24)|('D'<<16)|('O'<<8)|('S'))  //输出缓冲不足
+#define RET_DES_INPUT_SIZE_ERROR   (('R'<<24)|('D'<<16)|('I'<<8)|('S'))  //输入数据 len 错误
+#define RET_DES_RESULT_CHECK_ERROR (('R'<<24)|('D'<<16)|('R'<<8)|('C'))  //输出结果错误
 
-#define RET_DES_SUCCESS						(('R'<<24)|('D'<<16)|('S'<<8)|('C'))    
-#define RET_DES_FAILURE						(('R'<<24)|('D'<<16)|('F'<<8)|('A'))    
-#define RET_DES_KEY_IS_OK					(('R'<<24)|('D'<<16)|('K'<<8)|('O'))  
-#define RET_DES_KEY_IS_NULL					(('R'<<24)|('D'<<16)|('K'<<8)|('N'))  
-#define RET_DES_KEY_CRC_ERROR				(('R'<<24)|('D'<<16)|('K'<<8)|('C'))  
-#define RET_DES_KEY_READBACK_ERROR			(('R'<<24)|('D'<<16)|('K'<<8)|('R'))
-#define RET_DES_IV_CRC_ERROR					(('R'<<24)|('D'<<16)|('I'<<8)|('C'))  
-#define RET_DES_PACK_MODE_ERROR				(('R'<<24)|('D'<<16)|('P'<<8)|('E'))
-#define RET_DES_OUTBUF_TOO_SMALL				(('R'<<24)|('D'<<16)|('O'<<8)|('S'))
-#define RET_DES_INPUT_SIZE_ERROR				(('R'<<24)|('D'<<16)|('I'<<8)|('S'))
-#define RET_DES_RESULT_CHECK_ERROR			(('R'<<24)|('D'<<16)|('R'<<8)|('C'))
-
-#define DES_KEY_SIZE  8  
-#define DES_IV_SIZE 8
+#define DES_KEY_SIZE 8  
+#define DES_IV_SIZE  8
                                                
 typedef uint8_t DES_KeyTypeDef[DES_KEY_SIZE];
 typedef uint8_t DES_IvTypeDef[DES_IV_SIZE]; 
@@ -27,11 +26,10 @@
 typedef uint8_t DES_RandTypeDef[4]; 
 typedef uint8_t DES_FakeTypeDef[8]; 
 
-#define DES_TYPE_DES_ENC		(('D'<<24)|('T'<<16)|('D'<<8)|('E'))    
-#define DES_TYPE_DES_DEC			(('D'<<24)|('T'<<16)|('D'<<8)|('D'))    
-#define DES_TYPE_TDES_ENC			(('D'<<24)|('T'<<16)|('T'<<8)|('E'))    
-#define DES_TYPE_TDES_DEC			(('D'<<24)|('T'<<16)|('T'<<8)|('D'))    
-
+#define DES_TYPE_DES_ENC  (('D'<<24)|('T'<<16)|('D'<<8)|('E'))  //DES 加密模式
+#define DES_TYPE_DES_DEC  (('D'<<24)|('T'<<16)|('D'<<8)|('D'))  //DES 解密模式
+#define DES_TYPE_TDES_ENC (('D'<<24)|('T'<<16)|('T'<<8)|('E'))  //TDES 加密模式
+#define DES_TYPE_TDES_DEC (('D'<<24)|('T'<<16)|('T'<<8)|('D'))  //TDES 解密模式
 
 typedef struct         
 {                      
@@ -131,16 +129,16 @@
 //struct
 typedef struct
 {
-	uint8_t *result;//�������ָ��
-	uint8_t *content;//��������ָ��
-	uint8_t *key1;//��Կ1ָ��
-	uint8_t *key2;//��Կ2ָ��
-	uint8_t *key3;//��Կ3ָ��
-	uint8_t *iv;//cbcģ���ʼ����ָ��
-	uint8_t *rand;//�����2�ֽ�
-	uint8_t *fakekey;//����Կ8�ֽ�
-	uint8_t config;//des��������
-	uint32_t length;//cbcģʽ�µ������ֽ���
+	uint8_t *result;  //输出数据指针
+	uint8_t *content; //输入数据指针
+	uint8_t *key1;    //密钥1指针
+	uint8_t *key2;    //密钥2指针
+	uint8_t *key3;    //密钥3指针
+	uint8_t *iv;      //cbc模块初始向量指针
+	uint8_t *rand;    //随机数2字节
+	uint8_t *fakekey; //假秘钥8字节
+	uint8_t config;   //des运算配置
+	uint32_t length;  //cbc模式下的数据字节数
 }des_para;
 
 
Index: yc_ecc.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_ecc.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_ecc.h	(working copy)
@@ -4,59 +4,61 @@
 #include "yc_rsa.h"
 
 #define PLATFORM8 0xffffee
-#define PLATFORM 0xffffee11
+#define PLATFORM  0xffffee11
 
 
-#if PLATFORM==PLATFORM8
+#if PLATFORM == PLATFORM8
 #else
 
 typedef struct
 {
-	uint32_t *x;  //x������
-	uint32_t *y;  //y������
-}ecc_point_a;//��������
+	uint32_t *x;  //x轴坐标
+	uint32_t *y;  //y轴坐标
+}ecc_point_a;     //仿射坐标
 
 typedef struct
 {
-	uint32_t *x;  //x������
-	uint32_t *y;  //y������
-	uint32_t *z;  //z������
-}ecc_point_j;//�ſɱ�����
+	uint32_t *x;  //x轴坐标
+	uint32_t *y;  //y轴坐标
+	uint32_t *z;  //z轴坐标
+}ecc_point_j;     //雅可比坐标
 
 typedef struct
 {
-	uint32_t *x;  //x������
-	uint32_t *y;  //y������
-	uint32_t *z;  //z������
-	uint32_t *t;  //t������
-}ecc_point_mj;//�����ſɱ�����
-typedef struct
-{
-	uint32_t *p;        //ģ��--���ⲿ����
-	uint32_t *a;        //��Բ���߳���a--���ⲿ����
-	uint32_t *b;        //��Բ���߳���b--���ⲿ����
-	ecc_point_a g;    //����--���ⲿ����
-	uint32_t *n;        //����Ľ�--���ⲿ����
-	uint32_t len_bits;    //bitlen����λ��,���� 
-	uint32_t len_words;      //len���߳���,�� 
-	uint32_t field;     //��
-	uint32_t a_type;      //flag�ж�a�Ƿ����-3bit0��0-��ȣ�1-����--���ⲿ����
-	uint32_t *p_c;      //��pΪȡģ�ĳ���c
-	uint32_t p_q;       //��pΪȡģ�ĵ�������q
-	uint32_t *n_c;      //��pΪȡģ�ĳ���c
-	uint32_t n_q;       //��pΪȡģ�ĵ�������q
+	uint32_t *x;  //x轴坐标
+	uint32_t *y;  //y轴坐标
+	uint32_t *z;  //z轴坐标
+	uint32_t *t;  //t轴坐标
+}ecc_point_mj;    //修正雅可比坐标
+
+typedef struct
+{
+	uint32_t *p;        //模数--由外部传入
+	uint32_t *a;        //椭圆曲线常数a--由外部传入
+	uint32_t *b;        //椭圆曲线常数b--由外部传入
+	ecc_point_a g;      //基点--由外部传入
+	uint32_t *n;        //基点的阶--由外部传入
+	uint32_t len_bits;  //曲线位数,比特
+	uint32_t len_words; //曲线长度,字
+	uint32_t field;     //域
+	uint32_t a_type;    //判断a是否等于-3bit0：0-相等，1-不等--由外部传入
+	uint32_t *p_c;      //以p为取模的常量c
+	uint32_t p_q;       //以p为取模的调整因子q
+	uint32_t *n_c;      //以p为取模的常量c
+	uint32_t n_q;       //以p为取模的调整因子q
 	uint32_t *n1_c;
 	uint32_t n1_q;
-}ecc_para;//ecc������������ݽṹ
+}ecc_para;              //ecc输入参数的数据结构
+
 typedef struct
 {
-	uint32_t *d;        //ecc˽Կ
-	ecc_point_a e;    //ecc��Կ
-}ecc_key;//ecc��Կ�����ݽṹ
+	uint32_t *d;        //ecc私钥
+	ecc_point_a e;      //ecc公钥
+}ecc_key;               //ecc密钥的数据结构
 typedef struct
 {
-	uint32_t mask;//����ä��(��������)
-	uint32_t verify;//ָ��ä��(ָ������)
+	uint32_t mask;      //明文盲化(底数掩码)
+	uint32_t verify;    //指数盲化(指数掩码)
 }ecc_security;
 //macro define
 #define ECC_P192 0
@@ -80,16 +82,16 @@
 #define EMBEDED_PUBLIC_KEY_VERIFY (('E'<<24)|('P'<<16)|('K'<<8)|('V'))
 #define COMMON_PUBLIC_KEY_VERIFY  (('C'<<24)|('P'<<16)|('K'<<8)|('V'))
 
-#define RET_POINT_INFINITE_FAR				(('E'<<24)|('P'<<16)|('F'<<8)|('F'))
-#define RET_ECC_POINT_SUCCESS				(('E'<<24)|('P'<<16)|('S'<<8)|('U'))
-#define RET_ECC_POINT_FAILED					(('E'<<24)|('P'<<16)|('F'<<8)|('A'))
-#define RET_ECC_POINT_ADD_ERROR				(('E'<<24)|('P'<<16)|('A'<<8)|('E'))
-#define RET_ECC_POINT_MULT_ERROR				(('E'<<24)|('P'<<16)|('M'<<8)|('E'))
-#define RET_ECC_POINT_INFINITE_FAR			(('E'<<24)|('P'<<16)|('I'<<8)|('F'))
-#define RET_ECC_PUBLIC_KEY_FAILED			(('E'<<24)|('P'<<16)|('K'<<8)|('F'))
-#define RET_ECC_PUBLIC_KEY_PASS				(('E'<<24)|('P'<<16)|('K'<<8)|('P'))
-#define RET_ECC_KEY_GENERATION_SUCCESS		(('E'<<24)|('K'<<16)|('G'<<8)|('S'))
-#define RET_ECC_KEY_GENERATION_FAILED		(('E'<<24)|('K'<<16)|('G'<<8)|('F'))
+#define RET_POINT_INFINITE_FAR         (('E'<<24)|('P'<<16)|('F'<<8)|('F'))
+#define RET_ECC_POINT_SUCCESS          (('E'<<24)|('P'<<16)|('S'<<8)|('U'))
+#define RET_ECC_POINT_FAILED           (('E'<<24)|('P'<<16)|('F'<<8)|('A'))
+#define RET_ECC_POINT_ADD_ERROR        (('E'<<24)|('P'<<16)|('A'<<8)|('E'))
+#define RET_ECC_POINT_MULT_ERROR       (('E'<<24)|('P'<<16)|('M'<<8)|('E'))
+#define RET_ECC_POINT_INFINITE_FAR     (('E'<<24)|('P'<<16)|('I'<<8)|('F'))
+#define RET_ECC_PUBLIC_KEY_FAILED      (('E'<<24)|('P'<<16)|('K'<<8)|('F'))
+#define RET_ECC_PUBLIC_KEY_PASS        (('E'<<24)|('P'<<16)|('K'<<8)|('P'))
+#define RET_ECC_KEY_GENERATION_SUCCESS (('E'<<24)|('K'<<16)|('G'<<8)|('S'))
+#define RET_ECC_KEY_GENERATION_FAILED  (('E'<<24)|('K'<<16)|('G'<<8)|('F'))
 
 //function
 extern const  unsigned int  CONST_LONG_ONE[64]  ;
@@ -116,4 +118,4 @@
 
 #endif
 
-#endif
+#endif
\ No newline at end of file
Index: yc_rsa.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_rsa.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_rsa.h	(working copy)
@@ -3,42 +3,41 @@
 
 #include "yc_calc.h"
 
-
-#define MIN_RSA_MODULUS_BITS			1024
-#define MAX_RSA_MODULUS_BITS			2048
-#define MAX_RSA_MODULUS_BYTES		((MAX_RSA_MODULUS_BITS + 7) / 8)
-#define MAX_RSA_PRIME_BITS			((MAX_RSA_MODULUS_BITS + 1) / 2)
-#define MAX_RSA_PRIME_BYTES			((MAX_RSA_PRIME_BITS + 7) / 8)
+#define MIN_RSA_MODULUS_BITS  1024
+#define MAX_RSA_MODULUS_BITS  2048
+#define MAX_RSA_MODULUS_BYTES ((MAX_RSA_MODULUS_BITS + 7) / 8)
+#define MAX_RSA_PRIME_BITS    ((MAX_RSA_MODULUS_BITS + 1) / 2)
+#define MAX_RSA_PRIME_BYTES   ((MAX_RSA_PRIME_BITS + 7) / 8)
 
 typedef struct
 {
-		uint32_t bytes;							//�ֽڳ���
-		uint8_t e[4];							//��Կָ��
-		uint8_t p[MAX_RSA_PRIME_BYTES];	
-		uint32_t p_xor;
-		uint8_t q[MAX_RSA_PRIME_BYTES];		 
-		uint32_t q_xor;
-		uint8_t n[MAX_RSA_MODULUS_BYTES];    //ģ��n
-		uint8_t d[MAX_RSA_MODULUS_BYTES];    //˽Կָ��
-		uint8_t dp[MAX_RSA_PRIME_BYTES];		//d mod (p-1)
-		uint8_t dq[MAX_RSA_PRIME_BYTES];		//d mod (q-1)
-		uint8_t qp[MAX_RSA_PRIME_BYTES];		//q^-1 mod p 
-		uint8_t n_c[MAX_RSA_MODULUS_BYTES];	//ģ��n����C
-		uint8_t n_q[4];							//ģ��n����Q
-		uint8_t p_c[MAX_RSA_PRIME_BYTES];	//����p����C
-		uint8_t p_q[4];							//����p����Q
-		uint8_t q_c[MAX_RSA_PRIME_BYTES];	//����q����C
-		uint8_t q_q[4];							//����q����Q
+	uint32_t bytes;                       // RSA密钥长度字节数，即 RSA 密钥为 bytes * 8bits ，由于固定参数 MAX_RSA_MODULUS_BYTES 的限定，bytes 最大值为 256
+	uint8_t  e[4];                        // RSA 公钥指数
+	uint8_t  p[MAX_RSA_PRIME_BYTES];	    // RSA 素数 p
+	uint32_t p_xor;                       // p 异或校验值
+	uint8_t  q[MAX_RSA_PRIME_BYTES];      // RSA 素数 q
+	uint32_t q_xor;                       // q 异或校验值
+	uint8_t  n[MAX_RSA_MODULUS_BYTES];    // RSA 模数 n
+	uint8_t  d[MAX_RSA_MODULUS_BYTES];    // RSA 私钥指数
+	uint8_t  dp[MAX_RSA_PRIME_BYTES];     // d mod (p-1)
+	uint8_t  dq[MAX_RSA_PRIME_BYTES];     // d mod (q-1)
+	uint8_t  qp[MAX_RSA_PRIME_BYTES];     // q^-1 mod p 
+	uint8_t  n_c[MAX_RSA_MODULUS_BYTES];  // 模数 n 参数 C，用于 n 的模幂运算
+	uint8_t  n_q[4];                      // 模数 n 参数 Q，用于 n 的模幂运算
+	uint8_t  p_c[MAX_RSA_PRIME_BYTES];    // 模数 p 参数 C，用于 p 的模幂运算
+	uint8_t  p_q[4];                      // 模数 p 参数 Q，用于 p 的模幂运算
+	uint8_t  q_c[MAX_RSA_PRIME_BYTES];    // 模数 q 参数 C，用于 q 的模幂运算
+	uint8_t  q_q[4];                      // 模数 q 参数 Q，用于 q 的模幂运算
 }RSA_PrivateKeyTypeDef;
 
  
 typedef struct
 {
-	uint32_t bytes;								//�ֽڳ���
-	uint8_t e[4];								//��Կָ��
-	uint8_t n[MAX_RSA_MODULUS_BYTES];		//ģ��n
-	uint8_t n_c[MAX_RSA_MODULUS_BYTES];		//ģ��n����C
-	uint8_t n_q[4];								//ģ��n����Q
+	uint32_t bytes;                       //RSA密钥长度字节数，即 RSA 密钥为 bytes * 8bits ，由于固定参数 MAX_RSA_MODULUS_BYTES 的限定，bytes 最大值为 256
+	uint8_t  e[4];                        //RSA 公钥指数
+	uint8_t  n[MAX_RSA_MODULUS_BYTES];    //RSA 模数 n
+	uint8_t  n_c[MAX_RSA_MODULUS_BYTES];  //模数 n 参数 C，用于 n 的模幂运算
+	uint8_t  n_q[4];                      //模数 n 参数 Q，用于 n 的模幂运算
 }RSA_PublicKeyTypeDef;
 
 typedef enum
@@ -56,15 +55,14 @@
 } rsa_prime;
 
 //return value
-#define RET_RSA_RANDNUM_NOT_ACCEPT           (('R'<<24)|('R'<<16)|('N'<<8)|('A'))  //52524e41
-#define RET_RSA_KEYGEN_SUCCESS               (('R'<<24)|('K'<<16)|('G'<<8)|('S'))   ///524b4753
-#define RET_RSA_IMPLEMENT_SUCCESS            (('R'<<24)|('R'<<16)|('I'<<8)|('S'))  //52524953
-#define RET_RSA_IMPLEMENT_ERROR              (('R'<<24)|('R'<<16)|('A'<<8)|('E'))  ///52524145
-#define RET_PRIME_CHECK_PASS                 (('R'<<24)|('P'<<16)|('C'<<8)|('P'))  //52504350
-#define RET_PRIME_CHECK_FAIL                 (('R'<<24)|('P'<<16)|('C'<<8)|('F'))  //52504346
-
- #define RET_RSA_SUCCESS 					(('R'<<24)|('E'<<16)|('R'<<8)|('S'))
-#define RET_RSA_FAILURE 					(('R'<<24)|('E'<<16)|('R'<<8)|('E'))
+#define RET_RSA_RANDNUM_NOT_ACCEPT          (('R'<<24)|('R'<<16)|('N'<<8)|('A'))  //随机数不被接受
+#define RET_RSA_KEYGEN_SUCCESS              (('R'<<24)|('K'<<16)|('G'<<8)|('S'))  //RSA 密钥生成成功
+#define RET_RSA_IMPLEMENT_SUCCESS           (('R'<<24)|('R'<<16)|('I'<<8)|('S'))  //执行成功
+#define RET_RSA_IMPLEMENT_ERROR             (('R'<<24)|('R'<<16)|('A'<<8)|('E'))  //执行失败
+#define RET_PRIME_CHECK_PASS                (('R'<<24)|('P'<<16)|('C'<<8)|('P'))  //素数检查成功
+#define RET_PRIME_CHECK_FAIL                (('R'<<24)|('P'<<16)|('C'<<8)|('F'))  //素数检查失败
+#define RET_RSA_SUCCESS                     (('R'<<24)|('E'<<16)|('R'<<8)|('S'))  //RSA 计算成功
+#define RET_RSA_FAILURE                     (('R'<<24)|('E'<<16)|('R'<<8)|('E'))  //RSA 计算失败
 
 //#define RET_RSA_GKEY_SUCCESS		 		(('R'<<24)|('G'<<16)|('K'<<8)|('S'))
 //#define RET_RSA_GKEY_FAILURE		 		(('R'<<24)|('G'<<16)|('K'<<8)|('F'))
@@ -75,12 +73,12 @@
 /**
   * @method	RSA_Private
   * @brief	Raw RSA private-key operation. Useing CRT Algorithm
-  * @param	output		:output data buffer
-  * @param	input		:input data buffer
-  * @param	key			:RSA private key
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
-  * @retval				:RET_RSA_SUCCESS or RET_RSA_FAILURE
+  * @param	output : output data buffer
+  * @param	input  : input data buffer
+  * @param	key    : RSA private key
+  * @param	f_rng  : true random number generation function point
+  * @param	p_rng  : true random number generation para
+  * @retval	RET_RSA_SUCCESS or RET_RSA_FAILURE
   */
 uint32_t  RSA_Private_crt(uint8_t *output, uint8_t *input, RSA_PrivateKeyTypeDef *para,rng_callback f_rng, void *p_rng);
 //uint32_t RSA_PrivateStandard(uint8_t *output, uint8_t *input, RSA_PrivateKeyTypeDef *para,rng_callback f_rng, void *p_rng);
@@ -88,59 +86,56 @@
 /**
   * @method	RSA_Public
   * @brief	Raw RSA public-key operation. 
-  * @param	output		:output data buffer
-  * @param	input		:input data buffer
-  * @param	key			:RSA public key
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
-  * @retval				:RET_RSA_SUCCESS or RET_RSA_FAILURE
+  * @param	output : output data buffer
+  * @param	input  : input data buffer
+  * @param	key    : RSA public key
+  * @param	f_rng  : true random number generation function point
+  * @param	p_rng  : true random number generation para
+  * @retval RET_RSA_SUCCESS or RET_RSA_FAILURE
   */
-
 //RSA_Private_Standard standard not crt;
 uint32_t RSA_Private_Standard(uint8_t *output,uint8_t *input, RSA_PrivateKeyTypeDef *para,rng_callback f_rng, void *p_rng);
 
-uint32_t RSA_Public(uint8_t *output, uint8_t *input, RSA_PublicKeyTypeDef *key,
-							rng_callback f_rng, void *p_rng);
+uint32_t RSA_Public(uint8_t *output, uint8_t *input, RSA_PublicKeyTypeDef *key, rng_callback f_rng, void *p_rng);
 							
 /**
   * @method	RSA_GenerateKey
   * @brief	Generate a RSA private key
-  * @param	key			:rsa private key point
-  * @param	exponent	:public exponent
-  * @param	nbits		:rsa module bits
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
-  * @retval  RET_RSA_KEYGEN_SUCCESS or RET_RSA_RANDNUM_NOT_ACCEPT
+  * @param	key      : rsa private key point
+  * @param	exponent : public exponent
+  * @param	nbits    : rsa module bits
+  * @param	f_rng    : true random number generation function point
+  * @param	p_rng    : true random number generation para
+  * @retval RET_RSA_KEYGEN_SUCCESS or RET_RSA_RANDNUM_NOT_ACCEPT
   */
-uint32_t RSA_GenerateKey(RSA_PrivateKeyTypeDef *key, uint32_t exponent, uint32_t nbits,
-							rng_callback f_rng, void *p_rng);
+uint32_t RSA_GenerateKey(RSA_PrivateKeyTypeDef *key, uint32_t exponent, uint32_t nbits, rng_callback f_rng, void *p_rng);
 
 /**
   * @method	RSA_CompleteKey
   * @brief	complete the private key by the rsa key paras p q d. 
-  * @param	key			:rsa private key point
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
-  * @retval  RET_RSA_KEYGEN_SUCCESS or RET_RSA_RANDNUM_NOT_ACCEPT
+  * @param	key   : rsa private key point
+  * @param	f_rng : true random number generation function point
+  * @param	p_rng : true random number generation para
+  * @retval RET_RSA_KEYGEN_SUCCESS or RET_RSA_RANDNUM_NOT_ACCEPT
   */
 uint32_t RSA_CompleteKey(RSA_PrivateKeyTypeDef *key, rng_callback f_rng, void *p_rng);
 
 /**
   * @method	RSA_CompleteKey_e
   * @brief	complete the private key by the rsa key paras p q e. 
-  * @param	key			:rsa private key point
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
-  * @retval  RET_RSA_KEYGEN_SUCCESS or RET_RSA_RANDNUM_NOT_ACCEPT
+  * @param	key   : rsa private key point
+  * @param	f_rng : true random number generation function point
+  * @param	p_rng : true random number generation para
+  * @retval RET_RSA_KEYGEN_SUCCESS or RET_RSA_RANDNUM_NOT_ACCEPT
   */
 uint32_t RSA_CompleteKey_e(RSA_PrivateKeyTypeDef *key, rng_callback f_rng, void *p_rng);
 
 /**
   * @method	RSA_GetPrativeKey_C_Q
   * @brief	
-  * @param	key			:rsa private key point
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
+  * @param	key   : rsa private key point
+  * @param	f_rng : true random number generation function point
+  * @param	p_rng : true random number generation para
   * @retval RET_RSA_IMPLEMENT_SUCCESS or RET_RSA_IMPLEMENT_ERROR
   */
 uint32_t RSA_GetPrativeKey_C_Q(RSA_PrivateKeyTypeDef *key, rng_callback f_rng, void *p_rng);
@@ -148,19 +143,19 @@
 /**
   * @method	RSA_GetPublicKey_C_Q
   * @brief	
-  * @param	key			:rsa private key point
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
+  * @param	key   : rsa private key point
+  * @param	f_rng : true random number generation function point
+  * @param	p_rng : true random number generation para
   * @retval RET_RSA_IMPLEMENT_SUCCESS or RET_RSA_IMPLEMENT_ERROR
   */
 uint32_t RSA_GetPublicKey_C_Q(RSA_PublicKeyTypeDef *key, rng_callback f_rng, void *p_rng);
 /**
   * @method	RSA_IsPrime
   * @brief	
-  * @param	X			:big number array
-  * @param	size		:the big number len (32bit)
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
+  * @param	X     : big number array
+  * @param	size  : the big number len (32bit)
+  * @param	f_rng : true random number generation function point
+  * @param	p_rng : true random number generation para
   * @retval RET_PRIME_CHECK_PASS or RET_PRIME_CHECK_FAIL
   */
 uint32_t RSA_IsPrime( uint32_t *X, uint32_t size, rng_callback f_rng, void *p_rng);
@@ -168,10 +163,10 @@
 /**
   * @method	RSA_GeneratePrime
   * @brief	
-  * @param	X			:big number array
-  * @param	size		:the big number bits (192/256/512/1024)
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
+  * @param	X     : big number array
+  * @param	size  : the big number bits (192/256/512/1024)
+  * @param	f_rng : true random number generation function point
+  * @param	p_rng : true random number generation para
   * @retval RET_CALC_IMPLEMENT_SUCCESS or RET_RSA_IMPLEMENT_ERROR
   */
 uint32_t RSA_GeneratePrime( uint32_t *result, uint32_t nbits, rng_callback f_rng, void *p_rng);
Index: yc_sha.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_sha.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_sha.h	(working copy)
@@ -1,10 +1,9 @@
 #ifndef __YC_SHA_H__
 #define __YC_SHA_H__
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
 
-
 typedef enum
 {
 	SHATYPE_1	= 0,
@@ -15,37 +14,35 @@
 	SHATYPE_SM3 = 5
 }SHA_ModeTypeDef;
 
-
-#define RET_SHA_BUSY				(('R'<<24)|('S'<<16)|('B'<<8)|('U'))
-#define RET_SHA_MODE_ERR			(('R'<<24)|('S'<<16)|('M'<<8)|('E'))
-#define RET_SHA_SUCCESS			(('R'<<24)|('S'<<16)|('S'<<8)|('U'))
+#define RET_SHA_BUSY        (('R'<<24)|('S'<<16)|('B'<<8)|('U'))  //硬件单元处于忙状态
+#define RET_SHA_MODE_ERR    (('R'<<24)|('S'<<16)|('M'<<8)|('E'))  //输入计算类型错误
+#define RET_SHA_SUCCESS     (('R'<<24)|('S'<<16)|('S'<<8)|('U'))  //计算成功
 
 /**
   * @method	sha
   * @brief	Secure Hash Alogrithm
-  * @param	mode		:SHA mode: SHA_1/SHA_224/SHA_256/SHA_384/SHA_512
-  * @param	output		:output data buffer
-  * @param	input		:input data buffer
-  * @param	ibytes		:size of input data
-  * @retval 			:SHA_TYPE_ERR or SHA_CRYPT_BUSY
+  * @param	mode   : SHA mode: SHA_1/SHA_224/SHA_256/SHA_384/SHA_512
+  * @param	output : output data buffer
+  * @param	input  : input data buffer
+  * @param	ibytes : size of input data
+  * @retval SHA_TYPE_ERR or SHA_CRYPT_BUSY
   */
-uint32_t SHA(SHA_ModeTypeDef mode,  uint8_t *output, uint8_t *input,uint32_t ibytes);
+uint32_t SHA(SHA_ModeTypeDef mode, uint8_t *output, uint8_t *input,uint32_t ibytes);
 
 /**
   * @method	sha_sec
   * @brief	Secure Hash Alogrithm Rand Copy
-  * @param	mode		:SHA mode: SHA_256/SHA_384/SHA_512
-  * @param	output		:output data buffer
-  * @param	input		:input data buffer
-  * @param	ibytes		:size of input data
-  * @param	f_rng		:true random number generation function point
-  * @param	p_rng		:true random number generation para
-  * @retval 			:SHA_TYPE_ERR or SHA_CRYPT_BUSY
+  * @param	mode   : SHA mode: SHA_256/SHA_384/SHA_512
+  * @param	output : output data buffer
+  * @param	input  : input data buffer
+  * @param	ibytes : size of input data
+  * @param	f_rng  : true random number generation function point
+  * @param	p_rng  : true random number generation para
+  * @retval SHA_TYPE_ERR or SHA_CRYPT_BUSY
   */
 uint32_t SHA_Sec(SHA_ModeTypeDef mode,  uint8_t *output, uint8_t *input,uint32_t ibytes,
 							rng_callback f_rng, void *p_rng);
 
-
 /**
   * @method	sha
   * @brief	Secure Hash Alogrithm
@@ -76,5 +73,20 @@
   * @retval 			:SHA_TYPE_ERR or SHA_CRYPT_BUSY
   */
 uint32_t sha_last(SHA_ModeTypeDef mode,uint8_t *output,uint8_t *input,uint32_t ibytes);
+
+
+/**
+  * @method	SHA_Enhance
+  * @brief	Secure Hash Alogrithm
+  * @param	mode		:SHA mode: SHA_1/SHA_224/SHA_256/SHA_384/SHA_512
+  * @param	output		:output data buffer
+  * @param	input		:input data buffer
+  * @param	ibytes		:size of input data
+  * @param     totallen		:size of totallen
+  * @param     step               :step = 0 head,  step = 1 middle,  step = 2 tail 
+  * @retval 			:SHA_TYPE_ERR or SHA_CRYPT_BUSY
+  */
+uint32_t SHA_Enhance(SHA_ModeTypeDef mode,  uint8_t *output, uint8_t *input,uint32_t ibytes, uint32_t totallen,
+						uint8_t step);
 #endif
 
Index: yc_sm2.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_sm2.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_sm2.h	(working copy)
@@ -1,12 +1,12 @@
 #ifndef __YC_SM2_H__
 #define __YC_SM2_H__
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
-#include "..\core\system.h"
-#include "yc_ecc.h"
+#include "system.h"
 #include "yc_sm3.h"
-#include "..\sdk\yc_trng.h"
+#include "yc_ecc.h"
+#include "yc_trng.h"
 
 #define SM2_FLOW_CONTROL
 //#define BCTC
@@ -30,11 +30,11 @@
 
 typedef struct
 {
-	uint32_t p[SM2_KEY_WORDS];				//ģ�� --���ⲿ����
-	uint32_t a[SM2_KEY_WORDS];				//��Բ ���߳���a --���ⲿ����
-	uint32_t b[SM2_KEY_WORDS];				//��Բ ���߳���b --���ⲿ����
-	SM2_PointTypeDef g;						//����--���ⲿ����
-	uint32_t n[SM2_KEY_WORDS];				//����Ϊ�Ľ�---���ⲿ����
+	uint32_t p[SM2_KEY_WORDS];  //模数
+	uint32_t a[SM2_KEY_WORDS];  //椭圆曲线常数 a
+	uint32_t b[SM2_KEY_WORDS];  //椭圆曲线常数 b
+	SM2_PointTypeDef g;         //基点
+	uint32_t n[SM2_KEY_WORDS];  //基点的阶
 }SM2_EllipseParaTypeDef;
 
 typedef SM2_PointTypeDef SM2_PublicKeyTypeDef;
@@ -46,54 +46,92 @@
 }SM2_PrivateKeyTypeDef;
 
 
-#define RET_SM2_ENC_SUCCESS		 		(('R'<<24)|('S'<<16)|('E'<<8)|('S'))
-#define RET_SM2_ENC_FAILURE		 		(('R'<<24)|('S'<<16)|('E'<<8)|('F'))
-#define RET_SM2_DEC_SUCCESS		 		(('R'<<24)|('S'<<16)|('D'<<8)|('S'))
-#define RET_SM2_DEC_FAILURE		 		(('R'<<24)|('S'<<16)|('D'<<8)|('F'))
-#define RET_SM2_KDF_SUCCESS		 		(('R'<<24)|('S'<<16)|('K'<<8)|('S'))
-#define RET_SM2_KDF_FAILURE		 		(('R'<<24)|('S'<<16)|('K'<<8)|('F'))
-#define RET_SM2_SIGN_SUCCESS		 	(('R'<<24)|('S'<<16)|('S'<<8)|('S'))
-#define RET_SM2_SIGN_FAILURE		 	(('R'<<24)|('S'<<16)|('S'<<8)|('F'))
-#define RET_SM2_SIGN_ERROR		 		(('R'<<24)|('S'<<16)|('S'<<8)|('E'))
-#define RET_SM2_VERIFY_SUCCESS		 	(('R'<<24)|('S'<<16)|('V'<<8)|('S'))
-#define RET_SM2_VERIFY_FAILURE		 	(('R'<<24)|('S'<<16)|('V'<<8)|('F'))
-#define RET_SM2_VERIFY_ERROR		 		(('R'<<24)|('S'<<16)|('V'<<8)|('E'))
+#define RET_SM2_ENC_SUCCESS       (('R'<<24)|('S'<<16)|('E'<<8)|('S'))  //加密成功
+#define RET_SM2_ENC_FAILURE       (('R'<<24)|('S'<<16)|('E'<<8)|('F'))  //加密失败
+#define RET_SM2_DEC_SUCCESS       (('R'<<24)|('S'<<16)|('D'<<8)|('S'))  //解密成功
+#define RET_SM2_DEC_FAILURE       (('R'<<24)|('S'<<16)|('D'<<8)|('F'))  //解密失败
+#define RET_SM2_KDF_SUCCESS       (('R'<<24)|('S'<<16)|('K'<<8)|('S'))  //密钥派生成功
+#define RET_SM2_KDF_FAILURE       (('R'<<24)|('S'<<16)|('K'<<8)|('F'))  //密钥派生失败
+#define RET_SM2_SIGN_SUCCESS      (('R'<<24)|('S'<<16)|('S'<<8)|('S'))  //数字签名成功
+#define RET_SM2_SIGN_FAILURE      (('R'<<24)|('S'<<16)|('S'<<8)|('F'))  //数字签名错误
+#define RET_SM2_SIGN_ERROR        (('R'<<24)|('S'<<16)|('S'<<8)|('E'))  //数字签名错误
+#define RET_SM2_VERIFY_SUCCESS    (('R'<<24)|('S'<<16)|('V'<<8)|('S'))  //数字签名验证成功
+#define RET_SM2_VERIFY_FAILURE    (('R'<<24)|('S'<<16)|('V'<<8)|('F'))  //数字签名验证失败
+#define RET_SM2_VERIFY_ERROR      (('R'<<24)|('S'<<16)|('V'<<8)|('E'))  //数字签名验证错误
+
 
+/**
+  * @method	SM2_Genkey
+  * @brief	SM2 密钥生成函数，用于生成 SM2 密钥
+  * @param	key   : SM2 私钥（输出参数）
+  * @param	para  : 椭圆曲线参数（输入参数）
+  * @param	f_rng : 随机数函数（输入参数）
+  * @param	p_rng : 随机数函数参数（输入参数）
+  * @retval RET_ECC_KEY_GEN_SUCCESS or RET_SM2_KEY_GEN_ERROR
+  */
 uint32_t SM2_Genkey(SM2_PrivateKeyTypeDef *key, const SM2_EllipseParaTypeDef *para, 
-					rng_callback f_rng, void *p_rng);
+                    rng_callback f_rng, void *p_rng);
 
 //uint32_t SM2_Kdf(uint8_t *K, uint32_t klen, const uint8_t *Z, uint32_t zlen);
 /**
   * @method	SM2_Hash_z
   * @brief	get sm2 sign para Za
-  * @param	Za			:the Za para of sm2 sign
-  * @param	IDa			:user id
-  * @param	IDalen		:the bits of user id (8 * (number of bytes))
-  * @param	para		:sm2 paras
-  * @param	key			:sm2 public key
-  * @retval 			:nil
+  * @param	Za     : the Za para of sm2 sign
+  * @param	IDa    : user id
+  * @param	IDalen : the bits of user id (8 * (number of bytes))
+  * @param	para   : sm2 paras
+  * @param	key    : sm2 public key
+  * @retval nil
   */
 uint32_t SM2_Hash_Za(uint8_t *Za, uint8_t *IDa, uint16_t IDalen, SM2_EllipseParaTypeDef *para, SM2_PublicKeyTypeDef *key, uint16_t block_size);
 uint32_t SM2_Hash_z(uint8_t *Za, uint8_t *IDa, uint16_t IDalen, SM2_EllipseParaTypeDef *para, SM2_PublicKeyTypeDef *key);
+
 /**
   * @method	SM2_Hash_e
   * @brief	get sm2 sign para e
-  * @param	e			:the e para of sm2 sign (e is already cover bytes to integer)
-  * @param	Za			:the Za para of sm2 sign
-  * @param	m			:message
-  * @param	mlen		:bytes of message
-  * @retval 			:nil
+  * @param	e    : the e para of sm2 sign (e is already cover bytes to integer)
+  * @param	Za   : the Za para of sm2 sign
+  * @param	m    : message
+  * @param	mlen : bytes of message
+  * @retval nil
   */
 uint32_t SM2_Hash_e(uint32_t *e, uint8_t *Za, uint8_t *m, uint32_t mlen);
 
+/**
+  * @method	SM2_Enc
+  * @brief	SM2 公钥加解密函数，使用 SM2 公钥对数据进行加密或解密操作
+  * @param	output : 输出数据缓冲区的指针（输出参数）
+  * @param	Olen   : 输出数据长度（输出参数）
+  * @param	input  : 输入数据缓冲区的指针（输入参数）
+  * @param	ilen   : 输入数据长度（输入参数）
+  * @param	key    : SM2 公钥（输入参数）
+  * @param	para   : 椭圆曲线参数（输入参数）
+  * @param	f_rng  : 随机数函数（输入参数）
+  * @param	p_rng  : 随机数函数参数（输入参数）
+  * @retval RET_SM2_ENC_SUCCESS or RET_SM2_ENC_FAILURE
+  */
 uint32_t SM2_Enc(uint8_t *output, uint32_t *olen,
-					 uint8_t *input, uint32_t ilen,
-					 SM2_PublicKeyTypeDef *key,  SM2_EllipseParaTypeDef *para,
-					rng_callback f_rng, void *p_rng);
+                 uint8_t *input, uint32_t ilen,
+                 SM2_PublicKeyTypeDef *key,  SM2_EllipseParaTypeDef *para,
+                 rng_callback f_rng, void *p_rng);
+
+/**
+  * @method	SM2_Dec
+  * @brief	SM2 私钥加解密函数，使用 SM2 私钥对数据进行加密或解密操作
+  * @param	output : 输出数据缓冲区的指针（输出参数）
+  * @param	olen   : 输出数据长度（输出参数）
+  * @param	input  : 输入数据缓冲区的指针（输入参数）
+  * @param	ilen   : 输入数据长度（输入参数）
+  * @param	key    : SM2 私钥（输入参数）
+  * @param	para   : 椭圆曲线参数（输入参数）
+  * @param	f_rng  : 随机数函数（输入参数）
+  * @param	p_rng  : 随机数函数参数（输入参数）
+  * @retval RET_SM2_DEC_SUCCESS or RET_SM2_DEC_FAILURE
+  */
 uint32_t SM2_Dec(uint8_t *output, uint32_t *olen,
-					 uint8_t *input, uint32_t ilen,
-					 SM2_PrivateKeyTypeDef *key,  SM2_EllipseParaTypeDef *para,
-					rng_callback f_rng, void *p_rng);
+                 uint8_t *input, uint32_t ilen,
+                 SM2_PrivateKeyTypeDef *key,  SM2_EllipseParaTypeDef *para,
+                 rng_callback f_rng, void *p_rng);
 
 //uint32_t SM2_digital_sign(SM2_SignTypeDef *sign, uint8_t Za[32],
 //							uint8_t *msg, uint32_t mlen,
@@ -103,10 +141,38 @@
 //							uint8_t *msg, uint32_t mlen,
 //							SM2_PublicKeyTypeDef *key, SM2_EllipseParaTypeDef *para,
 //							mh_rng_callback f_rng, void *p_rng);
+					
+/**
+  * @method	SM2_DigitalSignWith_e
+  * @brief	SM2 数字签名函数
+  * @param	sign  : SM2 数字签名结果（输出参数）
+  * @param	e     : hash 值（输入参数）
+  * @param	msg   : 签名消息输入数据缓冲区的指针（输入参数）
+  * @param	mlen  : 签名消息数据长度（输入参数）
+  * @param	key   : SM2 私钥（输入参数）
+  * @param	para  : 椭圆曲线参数（输入参数）
+  * @param	f_rng : 随机数函数（输入参数）
+  * @param	p_rng : 随机数函数参数（输入参数）
+  * @retval RET_SM2_SIGN_SUCCESS or RET_SM2_SIGN_FAILURE
+  */
 uint32_t SM2_DigitalSignWith_e(SM2_SignTypeDef *sign, uint32_t *e,
-							uint8_t *msg, uint32_t mlen,
-							SM2_PrivateKeyTypeDef *key, SM2_EllipseParaTypeDef *para,
-							rng_callback f_rng, void *p_rng, uint8_t config);
+                               uint8_t *msg, uint32_t mlen,
+                               SM2_PrivateKeyTypeDef *key, SM2_EllipseParaTypeDef *para,
+                               rng_callback f_rng, void *p_rng, uint8_t config);
+
+/**
+  * @method	SM2_VerifySignWith_e
+  * @brief	SM2 签名验证函数
+  * @param	sign  : SM2 数字签名结果（输出参数）
+  * @param	e     : hash 值（输入参数）
+  * @param	msg   : 签名消息输入数据缓冲区的指针（输入参数）
+  * @param	mlen  : 签名消息数据长度（输入参数）
+  * @param	key   : SM2 私钥（输入参数）
+  * @param	para  : 椭圆曲线参数（输入参数）
+  * @param	f_rng : 随机数函数（输入参数）
+  * @param	p_rng : 随机数函数参数（输入参数）
+  * @retval RET_SM2_VERIFY_SUCCESS or RET_SM2_VERIFY_FAILURE
+  */
 uint32_t SM2_VerifySignWith_e(SM2_SignTypeDef *sign, uint32_t *e,
 							uint8_t *msg, uint32_t mlen,
 							SM2_PublicKeyTypeDef *key, SM2_EllipseParaTypeDef *para,
Index: yc_sm3.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_sm3.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_sm3.h	(working copy)
@@ -2,58 +2,56 @@
 #ifndef __YC_SM3_H__
 #define __YC_SM3_H__
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
-#include "..\core\system.h"
+#include "system.h"
 
-#define RET_SM3_BUSY				(('R'<<24)|('S'<<16)|('3'<<8)|('B'))
-#define RET_SM3_SUCCESS			(('R'<<24)|('S'<<16)|('3'<<8)|('S'))
-#define RET_SM3_FAILE 			(('R'<<24)|('S'<<16)|('3'<<8)|('F'))
+#define RET_SM3_BUSY         (('R'<<24)|('S'<<16)|('3'<<8)|('B'))  //
+#define RET_SM3_SUCCESS      (('R'<<24)|('S'<<16)|('3'<<8)|('S'))  //
+#define RET_SM3_FAILE        (('R'<<24)|('S'<<16)|('3'<<8)|('F'))  //
 
-#define RET_SM3_MAC_SUCCESS			(('S'<<24)|('3'<<16)|('M'<<8)|('U'))
-#define RET_SM4_MAC_FAILURE			(('S'<<24)|('3'<<16)|('M'<<8)|('F'))
+#define RET_SM3_MAC_SUCCESS  (('S'<<24)|('3'<<16)|('M'<<8)|('U'))  //RET_SM3_SUCCESS
+#define RET_SM4_MAC_FAILURE  (('S'<<24)|('3'<<16)|('M'<<8)|('F'))  //RET_SM3_BUSY
 
 /**
   * @method	sm3
   * @brief	SM3 Hash Check
-  * @param	output		:output data buffer
-  * @param	input		:input data buffer
-  * @param	ibytes		:size of input data
-  * @retval 			:SM3_SUCCESS or SM3_BUSY
+  * @param	output : output data buffer
+  * @param	input  : input data buffer
+  * @param	ibytes : size of input data
+  * @retval SM3_SUCCESS or SM3_BUSY
   */
 uint32_t SM3(uint8_t *output, uint8_t *input,uint32_t ibytes);
 
 /*
- * @brief:sm3 hash check
- * @param:output: output data buffer 
- * @param:input	: input data buffer
- * @param:ibytes: size of input data (when istep=0~1 ibytes must 64 multiples) 
- * @param:totalbytes : size of all input datas
- * @param:istep : 0~2
- * @return: SM3_SUCCESS or SM3_BUSY or SM3_FAILE
+ * @brief  sm3 hash check
+ * @param  output     : output data buffer 
+ * @param  input      : input data buffer
+ * @param  ibytes     : size of input data (when istep=0~1 ibytes must 64 multiples) 
+ * @param  totalbytes : size of all input datas
+ * @param  istep      : 0~2
+ * @return SM3_SUCCESS or SM3_BUSY or SM3_FAILE
  */
 uint32_t SM3_Enhance(uint8_t *output, uint8_t *input,uint32_t ibytes,uint32_t totalbytes,uint32_t istep);
 
-
 /*
- * @brief:sm3 hash check
- * @param:output: output data buffer 
- * @param:input	: input data 
- * @param:istep: number of data
- * @param:isend : is last data
- * @return: SM3_SUCCESS or SM3_BUSY or SM3_FAILE
+ * @brief  sm3 hash check
+ * @param  output : output data buffer 
+ * @param  input  : input data 
+ * @param  istep  : number of data
+ * @param  isend  : is last data
+ * @return SM3_SUCCESS or SM3_BUSY or SM3_FAILE
  */
 uint32_t SM3_BYTE(uint8_t *output, uint8_t input,uint32_t istep,uint8_t isend);
 
-
 /*
- * @brief:sm3-mac
- * @param:output: output data buffer 
- * @param:input	: input data  buffer
- * @param:ibytes: size of input buffer
- * @param:key : key buffer
- * @param:key_len : size of key buffer
- * @return: SM3_MAC_SUCCESS  or SM3_MAC_FAILE
+ * @brief  sm3-mac
+ * @param  output  : output data buffer 
+ * @param  input   : input data  buffer
+ * @param  ibytes  : size of input buffer
+ * @param  key     : key buffer
+ * @param  key_len : size of key buffer
+ * @return SM3_MAC_SUCCESS  or SM3_MAC_FAILE
  */
 uint32_t SM3_MAC(uint8_t *output, uint8_t *input,uint32_t ibytes,uint8_t *key,uint32_t key_len);
 
Index: yc_sm4.h
===================================================================
--- /YC3121_SDK/fw/crypt/yc_sm4.h	(revision 569)
+++ /YC3121_SDK/fw/crypt/yc_sm4.h	(working copy)
@@ -1,28 +1,28 @@
 #ifndef __YC_SM4_H__
 #define __YC_SM4_H__
 
-#include "..\core\yc3121.h"
+#include "yc3121.h"
 #include "yc_crypt.h"
-#include "..\core\system.h"
+#include "system.h"
 
 #define SM4_FLOW_CONTROL
 
-#define RET_SM4_SUCCESS			(('S'<<24)|('4'<<16)|('S'<<8)|('U'))
-#define RET_SM4_FAILURE			(('S'<<24)|('4'<<16)|('S'<<8)|('F'))
-#define RET_SM4_KEY_IS_NULL		(('S'<<24)|('4'<<16)|('K'<<8)|('N'))
-#define RET_SM4_PACK_MODE_ERROR	(('S'<<24)|('4'<<16)|('P'<<8)|('E'))
-#define RET_SM4_OUTBUF_TOO_SMALL		(('S'<<24)|('4'<<16)|('O'<<8)|('S'))
-#define RET_SM4_INPUT_SIZE_ERROR		(('S'<<24)|('4'<<16)|('P'<<8)|('S'))
-#define RET_SM4_KEY_READBACK_ERROR		(('S'<<24)|('4'<<16)|('K'<<8)|('R'))
-#define RET_SM4_RESULT_CHECK_ERROR		(('S'<<24)|('4'<<16)|('R'<<8)|('C'))
+#define RET_SM4_SUCCESS             (('S'<<24)|('4'<<16)|('S'<<8)|('U'))  //计算成功
+#define RET_SM4_FAILURE             (('S'<<24)|('4'<<16)|('S'<<8)|('F'))  //计算错误
+#define RET_SM4_KEY_IS_NULL         (('S'<<24)|('4'<<16)|('K'<<8)|('N'))
+#define RET_SM4_PACK_MODE_ERROR     (('S'<<24)|('4'<<16)|('P'<<8)|('E'))
+#define RET_SM4_OUTBUF_TOO_SMALL    (('S'<<24)|('4'<<16)|('O'<<8)|('S'))
+#define RET_SM4_INPUT_SIZE_ERROR    (('S'<<24)|('4'<<16)|('P'<<8)|('S'))
+#define RET_SM4_KEY_READBACK_ERROR  (('S'<<24)|('4'<<16)|('K'<<8)|('R'))
+#define RET_SM4_RESULT_CHECK_ERROR  (('S'<<24)|('4'<<16)|('R'<<8)|('C'))
 
 
-#define SM4_TYPE_DES_ENC		(('4'<<24)|('T'<<16)|('D'<<8)|('E'))    
-#define SM4_TYPE_DES_DEC			(('4'<<24)|('T'<<16)|('D'<<8)|('D'))    
+#define SM4_TYPE_DES_ENC            (('4'<<24)|('T'<<16)|('D'<<8)|('E'))    
+#define SM4_TYPE_DES_DEC            (('4'<<24)|('T'<<16)|('D'<<8)|('D'))    
 
 
-#define SM4_KEY_SIZE			(128 / 8)
-#define SM4_IV_SIZE			(128 / 8)
+#define SM4_KEY_SIZE  (128 / 8)
+#define SM4_IV_SIZE   (128 / 8)
 	
 typedef uint8_t SM4_KeyTypeDef[SM4_KEY_SIZE];
 typedef uint8_t SM4_IvTypeDef[SM4_IV_SIZE];
@@ -30,41 +30,41 @@
 /**
   * @method	SM4_Enc
   * @brief	sm4 encrypt function
-  * @param	pack_mode		:block encryption mode ECB or CBC
-  * @param	output			:the pointer of output data buffer
-  * @param	obytes			:the size of output data buffer
-							("obytes" must be bigger or equal then "iBytes")
-  * @param	input			:the pointer of input data buffer
-  * @param	ibytes			:the size of input data buffer
-							("ibytes" must be an integer multiple of key length)
-  * @param	key				:SM4 key
-  * @param	iv				:initialization vector
-  * @retval					:SM4 return value
+  * @param	pack_mode : block encryption mode ECB or CBC
+  * @param	output    : the pointer of output data buffer
+  * @param	obytes    : the size of output data buffer
+  *                     ("obytes" must be bigger or equal then "iBytes")
+  * @param	input     : the pointer of input data buffer
+  * @param	ibytes    : the size of input data buffer
+  *                     ("ibytes" must be an integer multiple of key length)
+  * @param	key       : SM4 key
+  * @param	iv        : initialization vector
+  * @retval SM4 return value
   */
 uint32_t SM4_Enc(PACK_ModeTypeDef pack_mode, 
-					 uint8_t *output, uint32_t obytes, 
-					 uint8_t *input, uint32_t ibytes, 
-					 SM4_KeyTypeDef key, SM4_IvTypeDef iv,
-					 rng_callback f_rng, void *p_rng);
+                 uint8_t *output, uint32_t obytes, 
+                 uint8_t *input, uint32_t ibytes, 
+                 SM4_KeyTypeDef key, SM4_IvTypeDef iv,
+                 rng_callback f_rng, void *p_rng);
 
 /**
   * @method	SM4_Dec
   * @brief	SM4 decrypt function
-  * @param	pack_mode		:block encryption mode ECB or CBC
-  * @param	output			:the pointer of output data buffer
-  * @param	obytes			:the size of output data buffer
-							("obytes" must be bigger or equal then "iBytes")
-  * @param	input			:the pointer of input data buffer
-  * @param	ibytes			:the size of input data buffer
-							("ibytes" must be an integer multiple of key length)
-  * @param	key				:SM4 key
-  * @param	iv				:initialization vector
-  * @retval					:SM4 return value
+  * @param	pack_mode : block encryption mode ECB or CBC
+  * @param	output    : the pointer of output data buffer
+  * @param	obytes    : the size of output data buffer
+  *                     ("obytes" must be bigger or equal then "iBytes")
+  * @param	input     : the pointer of input data buffer
+  * @param	ibytes    : the size of input data buffer
+  *                     ("ibytes" must be an integer multiple of key length)
+  * @param	key       : SM4 key
+  * @param	iv        : initialization vector
+  * @retval SM4 return value
   */
 uint32_t SM4_Dec(PACK_ModeTypeDef pack_mode, 
-					uint8_t *output, uint32_t obytes, 
-					uint8_t *input, uint32_t ibytes, 
-					SM4_KeyTypeDef key, SM4_IvTypeDef iv,
-					rng_callback f_rng, void *p_rng);
+                 uint8_t *output, uint32_t obytes, 
+                 uint8_t *input, uint32_t ibytes, 
+                 SM4_KeyTypeDef key, SM4_IvTypeDef iv,
+                 rng_callback f_rng, void *p_rng);
 
 #endif

