[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/boot/common/src/loader/drivers/drv_rsa.h b/boot/common/src/loader/drivers/drv_rsa.h
new file mode 100644
index 0000000..379f155
--- /dev/null
+++ b/boot/common/src/loader/drivers/drv_rsa.h
@@ -0,0 +1,72 @@
+

+#ifndef RSA_DRV_H

+#define RSA_DRV_H

+

+#include <common.h>

+

+

+#define SYS_RSA_BASE					0x0121c000

+

+

+/**< offset:000  RW        °æ±¾ÐÅÏ¢¼Ä´æÆ÷                */

+/**< offset:004  RW        Ä£¿éʹÄܼĴæÆ÷                */

+/**< offset:008  RW        Ä£³¤¼Ä´æÆ÷                    */

+/**< offset:00C  RW        Ãݳ¤¼Ä´æÆ÷                    */

+/**< offset:010  RW        ÖжÏ״̬¼Ä´æÆ÷                */

+/**< offset:014  RW        ÖжÏʹÄܼĴæÆ÷                */

+/**< offset:018  RW        ÖÐ¶ÏÆÁ±Î¼Ä´æÆ÷                */

+/**< offset:01C  RW        N0¼Ä´æÆ÷                      */

+/**< offset:020  RW        N0¡¯¼Ä´æÆ÷                    */

+/**< offset:024  RW        ¼ÆËãģʽ                      */

+/**< offset:028  RW        ռλ·û                        */     

+/**< offset:100  RW        M data RAM¼Ä´æÆ÷0x100~0x1FF   */

+/**< offset:200  RW        E data RAM¼Ä´æÆ÷0x200~0x2FF   */

+/**< offset:300  RW        N data RAM¼Ä´æÆ÷0x300~0x3FF   */

+/**< offset:400  RW        ³õʼ»¯¼ÆËãRAM¼Ä´æÆ÷0x400~0x4FF*/

+/**< offset:500  RW        ½á¹ûRAM¼Ä´æÆ÷0x500~0x5FF      */

+

+

+#define RSA_REV_INFO        		(SYS_RSA_BASE)

+#define RSA_MODULE_ENABLE   	(SYS_RSA_BASE+0x4)

+#define RSA_MODULAR_LENGTH 	(SYS_RSA_BASE+0x8)

+#define RSA_EXP_LENGTH      		(SYS_RSA_BASE+0xc)

+#define RSA_INT_STATUS      		(SYS_RSA_BASE+0x10)

+#define RSA_INT_ENABLE      		(SYS_RSA_BASE+0x14)

+#define RSA_INT_MASK        		(SYS_RSA_BASE+0x18)

+#define RSA_NZORE           			(SYS_RSA_BASE+0x1c)

+#define RSA_NZORE_INV       		(SYS_RSA_BASE+0x20)

+#define RSA_CALC_MODE       		(SYS_RSA_BASE+0x24)

+#define RSA_M_RAM           		(SYS_RSA_BASE+0x100)

+#define RSA_E_RAM           		(SYS_RSA_BASE+0x200)

+#define RSA_N_RAM           		(SYS_RSA_BASE+0x300)

+#define RSA_INIT_CALC_RAM   	(SYS_RSA_BASE+0x400)

+#define RSA_RESULT_RAM      		(SYS_RSA_BASE+0x500)

+

+//Çý¶¯ÊÇ·ñÖ§³ÖËùÓеÄģʽ£¬ÓÃÓÚ¼ò»¯´úÂëÁ¿

+//#define RSA_CODE_SUPPORT_ALL

+

+#ifdef RSA_CODE_SUPPORT_ALL

+#define RSA_BIG_NUM_MULTIPLE             	9	//input M, E, udNbitLen

+#define RSA_INIT_COMPUTE                 		2	//input N, udNbitLen

+#define RSA_MOD_MULTIPLE_NO_INIT         8	//input M, E, N, C, udNbitLen, udEbitLen

+#define RSA_MOD_EXPO_NO_INIT             	4	//input M, E, N, C, udNbitLen, udEbitLen

+#define RSA_MOD_MULTIPLE_WITH_INIT     10	//input M, E, N, udNbitLen, udEbitLen

+#endif

+#define RSA_MOD_EXPO_WITH_INIT    	       6	//input M, E, N, udNbitLen, udEbitLen

+

+/** RSAÇý¶¯¼ÆËã½Ó¿Ú´«Èë²ÎÊý*/

+typedef struct

+{

+    u32 udCalMode;    /**< RSA¼ÆËãģʽ     */                                         

+    u32 udNbitLen;     /**< Ä£ÊýN µÄλÊý»òÕßM µÄλÊý , ¿ÉÑ¡512, 1024, 1536, 2048 */

+    u32 udEbitLen;     /**< ÃÝÊýE µÄλÊý, СÓÚ64   */

+    u32 *pudInputM;   /**< ÊäÈëM»º´æÇø    --ÏûÏ¢M          */

+    u32 *pudInputE;   /**< ÊäÈëE»º´æÇø     --ÃÝÊýE          */

+    u32 *pudInputN;   /**< ÊäÈëÄ£»º´æÇø --Ä£ÊýN  (Á½ËØÊýµÄ³Ë»ý)  */

+    u32 *pudInputC;   /**< ÊäÈëÔ¤¼ÆËãÖµ»º´æÇø,µÈÓÚr^2 mod N   */

+    u32 *pudOutputP;  /**< Êä³ö½á¹û»º´æÇø */

+}T_Rsa_Paramter;

+

+u32 Rsa_Calculate(T_Rsa_Paramter ptInput);

+#endif

+