[Bugfix][R306][bug-view-2169][secure] sync AT+RSCYINFO

Change-Id: I1bf69d3543c4e5dc6341d997c8da3aca8140bc21
diff --git a/lynq/MD310EU/ap/lib/libatext/ext_amt_func.c b/lynq/MD310EU/ap/lib/libatext/ext_amt_func.c
index 3791fd7..3052b66 100755
--- a/lynq/MD310EU/ap/lib/libatext/ext_amt_func.c
+++ b/lynq/MD310EU/ap/lib/libatext/ext_amt_func.c
@@ -2058,6 +2058,56 @@
 	close(efuse_fd);

     return AT_END;

 }

+

+int read_security_info(int at_fd, char *at_paras, void **res_msg, int *res_msglen)

+{

+    char strValue[16];

+    char strLog[256] = {0};

+    int i;

+	int ret = 0;

+	T_ZDrvEfuse_Secure efuseInfo = {{0}};

+	int efuse_fd = -1;

+	

+    efuse_fd = open("/dev/efuse", O_RDWR);

+	if (efuse_fd < 0) 

+	{

+		at_print(AT_ERR,"open %s fail.\n","/dev/efuse");

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen(*res_msg);

+		return AT_END;

+	}

+

+	at_print(AT_ERR,"open %s success.\n","/dev/efuse");

+

+	 // ´Óefuse¶ÁÈ¡

+    if(ioctl(efuse_fd , EFUSE_GET_DATA, &efuseInfo)!= 0)

+    {

+        at_print(AT_ERR,"ioctl: EFUSE_GET_DATA fail.\n");

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen(*res_msg);

+		close(efuse_fd);

+		return AT_END;

+    }

+	else

+	{

+	    at_print(AT_ERR,"ioctl: EFUSE_GET_DATA success.\n");

+		strLog[0] = '\0';

+		sprintf(strValue, "%02X,", efuseInfo.secureFlag&0xFF);

+		strcat(strLog, strValue);

+    	for (i = 0; i < sizeof(efuseInfo.pubKeyHash)/sizeof(UINT32); i++)

+    	{

+    	    sprintf(strValue, "%08lX", efuseInfo.pubKeyHash[i]);

+        	strcat(strLog, strValue);

+    	}

+		at_print(AT_ERR, "Secure Flag,Public key hash: %s\n", strLog);

+		close(efuse_fd);

+		*res_msg = at_query_result_build("read security information", strLog);

+        *res_msglen = strlen(*res_msg);

+		return AT_END;

+		

+	}

+}

+

 /*

 int auth_device_key(int at_fd, char *at_paras,void ** res_msg, int *res_msglen)

 {

@@ -2130,5 +2180,6 @@
     register_serv_func2("zmode=",0,0,0,zmodeSet_act_func,NULL); 

 	//mdlÓû§Ä£Ê½ÇÐÑз¢Ä£Ê½¼øÈ¨AT+ZAUTH=KEY

 	//register_serv_func2("ZAUTH=",0,0,0,auth_device_key,NULL);

+    register_serv_func2("RSCYINFO",0,0,0,read_security_info,NULL);

     return 0;

 }