[Feature][ZXW-130]merge P50U02 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I4f29ec5bb7c59385f23738d2b7ca84e67c100f69
diff --git a/ap/lib/libatext/ext_amt_func.c b/ap/lib/libatext/ext_amt_func.c
index d5470d5..4460b51 100755
--- a/ap/lib/libatext/ext_amt_func.c
+++ b/ap/lib/libatext/ext_amt_func.c
@@ -36,6 +36,7 @@
 #include "nv_api.h"

 #include "amtnv.h"

 #include <linux/soc/zte/efuse/efuse_zx.h>

+#include <linux/soc/zte/otp/otp_zx.h>

 #include "NvParam_drv.h"

 #include "libkey.h"

 

@@ -1924,6 +1925,134 @@
     return AT_END;

 }

 

+

+#define SHA256_ROTL(a,b) (((a>>(32-b))&(0x7fffffff>>(31-b)))|(a<<b))

+#define SHA256_SR(a,b) ((a>>b)&(0x7fffffff>>(b-1)))

+#define SHA256_Ch(x,y,z) ((x&y)^((~x)&z))

+#define SHA256_Maj(x,y,z) ((x&y)^(x&z)^(y&z))

+#define SHA256_E0(x) (SHA256_ROTL(x,30)^SHA256_ROTL(x,19)^SHA256_ROTL(x,10))

+#define SHA256_E1(x) (SHA256_ROTL(x,26)^SHA256_ROTL(x,21)^SHA256_ROTL(x,7))

+#define SHA256_O0(x) (SHA256_ROTL(x,25)^SHA256_ROTL(x,14)^SHA256_SR(x,3))

+#define SHA256_O1(x) (SHA256_ROTL(x,15)^SHA256_ROTL(x,13)^SHA256_SR(x,10))

+

+

+/**

+ * @brief ¼ÆËãSHA-256

+ * @param[in,out] str     ÐèÒª¼ÆËãSHA-256 hashÖµµÄÂëÁ÷Ö¸Õë

+ * @param[in,out] length  ÂëÁ÷³¤¶È

+ * @param[in,out] sha256  ÓÃÓÚ±£´æSHA-256µÄÖ¸Õë

+ * @return ³É¹¦·µ»Øsha256£¬Ê§°Ü·µ»Ø0

+ * @note

+ * @see 

+ */

+

+unsigned char* StrSHA256(const unsigned char* str, long long length, unsigned char* sha256)

+{

+    /*

+    ¼ÆËã×Ö·û´®SHA-256

+    ²ÎÊý˵Ã÷£º

+    str         ×Ö·û´®Ö¸Õë

+    length      ×Ö·û´®³¤¶È

+    sha256         ÓÃÓÚ±£´æSHA-256µÄ×Ö·û´®Ö¸Õë

+    ·µ»ØÖµÎª²ÎÊýsha256

+    */

+    unsigned char *pp, *ppend;

+    long l, i, W[64], T1, T2, A, B, C, D, E, F, G, H, H0, H1, H2, H3, H4, H5, H6, H7;

+    H0 = 0x6a09e667, H1 = 0xbb67ae85, H2 = 0x3c6ef372, H3 = 0xa54ff53a;

+    H4 = 0x510e527f, H5 = 0x9b05688c, H6 = 0x1f83d9ab, H7 = 0x5be0cd19;

+    long K[64] = {

+        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,

+        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,

+        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,

+        0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,

+        0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,

+        0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,

+        0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,

+        0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,

+    };

+    l = length + ((length % 64 >= 56) ? (128 - length % 64) : (64 - length % 64));

+    if (!(pp = (unsigned char*)malloc((unsigned long)l))) return 0;

+    for (i = 0; i < length; pp[i + 3 - 2 * (i % 4)] = str[i], i++);

+    for (pp[i + 3 - 2 * (i % 4)] = 128, i++; i < l; pp[i + 3 - 2 * (i % 4)] = 0, i++);

+    *((long*)(pp + l - 4)) = length << 3;

+    *((long*)(pp + l - 8)) = length >> 29;

+    for (ppend = pp + l; pp < ppend; pp += 64){

+        for (i = 0; i < 16; W[i] = ((long*)pp)[i], i++);

+        for (i = 16; i < 64; W[i] = (SHA256_O1(W[i - 2]) + W[i - 7] + SHA256_O0(W[i - 15]) + W[i - 16]), i++);

+        A = H0, B = H1, C = H2, D = H3, E = H4, F = H5, G = H6, H = H7;

+        for (i = 0; i < 64; i++){

+            T1 = H + SHA256_E1(E) + SHA256_Ch(E, F, G) + K[i] + W[i];

+            T2 = SHA256_E0(A) + SHA256_Maj(A, B, C);

+            H = G, G = F, F = E, E = D + T1, D = C, C = B, B = A, A = T1 + T2;

+        }

+        H0 += A, H1 += B, H2 += C, H3 += D, H4 += E, H5 += F, H6 += G, H7 += H;

+    }

+    free(pp - l);

+    memcpy(sha256,&H0,sizeof(H0));

+	memcpy(sha256 + sizeof(H0),&H1,sizeof(H1));

+	memcpy(sha256 + sizeof(H0) + sizeof(H1),&H2,sizeof(H2));

+	memcpy(sha256 + sizeof(H0) + sizeof(H1) + sizeof(H2),&H3,sizeof(H3));

+	memcpy(sha256 + sizeof(H0) + sizeof(H1) + sizeof(H2) + sizeof(H3),&H4,sizeof(H4));

+	memcpy(sha256 + sizeof(H0) + sizeof(H1) + sizeof(H2) + sizeof(H3) + sizeof(H4),&H5,sizeof(H5));

+	memcpy(sha256 + sizeof(H0) + sizeof(H1) + sizeof(H2) + sizeof(H3) + sizeof(H4) + sizeof(H5),&H6,sizeof(H6));

+	memcpy(sha256 + sizeof(H0) + sizeof(H1) + sizeof(H2) + sizeof(H3) + sizeof(H4) + sizeof(H5) + sizeof(H6),&H7,sizeof(H7));

+    return sha256;

+}

+

+static int IsEnhancedSecurity()

+{

+    #define CMDLINE_MAX_SIZE   (4*1024)

+    int cmdline_fd = -1;

+	char*cmdline_buf = malloc(CMDLINE_MAX_SIZE);

+	char*temp = NULL;

+	int ret_size = 0;

+	if(cmdline_buf == NULL)

+	{

+	    at_print(AT_ERR,"malloc cmdline_buf fail.\n");

+		return -1;

+	}

+    //²éÕÒcmdlineÖеÄEnhancedSecurityÊÇ·ñ´æÔÚ

+	cmdline_fd = open("/proc/cmdline", O_RDONLY);

+	if (cmdline_fd < 0) {

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

+		return -1;

+	}

+	ret_size = read(cmdline_fd, cmdline_buf, CMDLINE_MAX_SIZE);

+	if(ret_size <= 0)

+	{

+		at_print(AT_ERR,"read /proc/cmdline fail.\n");

+		close(cmdline_fd);

+		return -1;

+	}

+	close(cmdline_fd);

+    temp = strstr(cmdline_buf,"EnhancedSecurity=");

+	if(temp == NULL)

+	{

+    	at_print(AT_ERR,"can not find EnhancedSecurity=\n");

+		return -1;

+	}

+	temp = temp + strlen("EnhancedSecurity=");

+	if(temp == NULL)

+	{

+    	at_print(AT_ERR,"temp = NULL\n");

+		return -1;

+	}

+	if(*temp == '0')

+	{

+		return 0;

+	}

+	else if(*temp == '1')

+	{

+	    at_print(AT_ERR,"EnhancedSecurity=1\n");

+		return 1;

+	}

+	else

+	{

+		return -1;

+	}

+}

+

+

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

 {

     UINT32 pubKeyHash[4] = {0};

@@ -1934,8 +2063,23 @@
     md5_ctx stStc;

     int i;

 	int efuse_fd = -1;

-	//int ret = -1;

 

+	UINT32 pubKeyHash_otp[8] = {0};

+	UINT32 secureFlag_otp = 0x00;

+	T_ZDrvOtp_Secure otpInfo = {{0}};

+	int otp_fd = -1;

+	int is_Enhanced_Security = -1;

+

+	is_Enhanced_Security = IsEnhancedSecurity();

+	at_print(AT_ERR,"is_Enhanced_Security = %d.\n",is_Enhanced_Security);

+	if(is_Enhanced_Security == -1)

+	{

+		at_print(AT_ERR,"IsEnhancedSecurity() fail.\n");

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen(*res_msg);

+		return AT_END;

+	}

+   

     /*************************»ñÈ¡¹«Ô¿hash**************************/

     // »ñÈ¡¹«Ô¿

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

@@ -1946,6 +2090,8 @@
 		return AT_END;

 	}

 

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

+

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

 	{

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

@@ -1954,7 +2100,81 @@
 		close(efuse_fd);

 		return AT_END;

 	}

-	at_print(AT_NORMAL, "security flag in efuse: %08X\r", efuseInfo.secureFlag);

+	at_print(AT_ERR, "security flag in efuse: %08X\n", efuseInfo.secureFlag);

+

+	//ÅжÏefuseÀïÃæµÄ¹«Ô¿ÊÇ·ñºÏ·¨£¬Èç¹ûÊÇÈ«0£¬Ö±½ÓÍ˳ö

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

+    {

+    	if(efuseInfo.pubKeyRsaE[i] != 0)

+    	{

+    		break;

+		}

+	}

+	if(i == sizeof(efuseInfo.pubKeyRsaE)/sizeof(UINT32))

+	{

+		at_print(AT_ERR,"efuse pubkey E is all zero.\n");

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen(*res_msg);

+		close(efuse_fd);

+		return AT_END;

+	}

+

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

+    {

+    	if(efuseInfo.pubKeyRsaN[i] != 0)

+    	{

+    		break;

+		}

+	}

+	if(i == sizeof(efuseInfo.pubKeyRsaN)/sizeof(UINT32))

+	{

+		at_print(AT_ERR,"efuse pubkey N is all zero.\n");

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen(*res_msg);

+		close(efuse_fd);

+		return AT_END;

+	}

+

+

+	   // ´òÓ¡¹«Ô¿

+		#if 1

+		strLog[0] = '\0';

+		for (i = 0; i < 16; i++)

+		{

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

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "efuse Pubkey E1: %s\n", strLog);

+

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 16; i < 32; i++)

+		{

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

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "efuse Pubkey E2: %s\n", strLog);

+		

+        memset(strLog, 0, sizeof(strLog));

+	    for (i = 0; i < 16; i++)

+		{

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

+			strcat(strLog, strValue);

+		}

+	

+		at_print(AT_ERR, "efuse Pubkey N1: %s\n", strLog);

+	

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 16; i < 32; i++)

+		{

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

+			strcat(strLog, strValue);

+		}

+	

+		at_print(AT_ERR, "efuse Pubkey N2: %s\n", strLog);

+		#endif

+	

 	

     // ¼ÆË㹫ԿhashÖµ

     md5_init(&stStc);

@@ -1975,16 +2195,16 @@
         strcat(strLog, strValue);

     }

 

-    at_print(AT_NORMAL, "Public key hash: %s\r", strLog);

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

 	

 	/*************************½«°²È«ÐÅϢдÈëefuse**************************/

-	

+	#if 1

 	if (memcmp(efuseInfo.pubKeyHash, pubKeyHash, sizeof(pubKeyHash)) != 0)

 	{

 		// ¹«Ô¿hashֵдÈëefuse

 		if (ioctl(efuse_fd , EFUSE_SET_PUB_KEY_HASH, pubKeyHash) != 0)

 		{

-	    	at_print(AT_ERR, "Write public key hash to efuse fail!\r");

+	    	at_print(AT_ERR, "Write public key hash to efuse fail!\n");

 			*res_msg = at_err_build(ATERR_PROC_FAILED);

 			*res_msglen = strlen(*res_msg);

 			close(efuse_fd);

@@ -1992,13 +2212,37 @@
 		}

 		else

 		{

-			at_print(AT_NORMAL, "Write public key hash to efuse success!\r");

+			at_print(AT_ERR, "Write public key hash to efuse success!\n");

 		}

     }

 	else

 	{

-		at_print(AT_NORMAL, "Public key's hash value already exists!\r");

+		at_print(AT_ERR, "Public key's hash value already exists!\n");

 	}

+

+    /*************************ÅжÏдÈëµÄ¹«Ô¿hashÖµÊÇ·ñÕýÈ·**************************/

+	// ´Óefuse¶ÁÈ¡

+    memset(&efuseInfo, 0, sizeof(efuseInfo));

+    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;

+    }

+	if (memcmp(efuseInfo.pubKeyHash, pubKeyHash, sizeof(pubKeyHash)) != 0)

+    {

+        at_print(AT_ERR, "Public key hash is not consistent!\n");

+        *res_msg = at_err_build(ATERR_PROC_FAILED);

+        *res_msglen = strlen(*res_msg);

+		close(efuse_fd);

+        return AT_END;

+    }

+	#endif

+

+	#if 1

+

 	/*efuseInfo.secureFlagÇ°Ãæ3¸ö×Ö½ÚÊÇchip flag,×îºóÒ»¸ö×Ö½ÚÊǰ²È«Ê¹ÄܱêÖ¾*/

 	

     if ((efuseInfo.secureFlag&0xff) != secureFlag)

@@ -2043,21 +2287,321 @@
 		close(efuse_fd);

         return AT_END;

     }

+	#endif

+    close(efuse_fd);

+	

+	if(is_Enhanced_Security == 0)

+	{

+		*res_msg = at_query_result_build("write security infomation", NULL);

+    	*res_msglen = strlen(*res_msg);

+	     return AT_END;

+	}

+	

+	if(is_Enhanced_Security == 1)

+	{

+		/*************************»ñÈ¡¹«Ô¿hash**************************/

+	    // »ñÈ¡¹«Ô¿

+		otp_fd = open("/dev/otp", O_RDWR);

+		if (otp_fd < 0) {

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

+			*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/otp");

 

-    if (memcmp(efuseInfo.pubKeyHash, pubKeyHash, sizeof(pubKeyHash)) != 0)

-    {

-        at_print(AT_ERR, "Public key hash is not consistent!\r");

-        *res_msg = at_err_build(ATERR_PROC_FAILED);

-        *res_msglen = strlen(*res_msg);

-		close(efuse_fd);

-        return AT_END;

-    }

+		if(ioctl(otp_fd , OTP_GET_DATA, &otpInfo)!= 0)

+		{

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

+			*res_msg = at_err_build(ATERR_PROC_FAILED);

+			*res_msglen = strlen(*res_msg);

+			close(otp_fd);

+			return AT_END;

+		}

+	

+		at_print(AT_ERR, "security flag in otp: %08X\n", otpInfo.secureFlag);

 

-    *res_msg = at_query_result_build("write security infomation", NULL);

-    *res_msglen = strlen(*res_msg);

-	close(efuse_fd);

-    return AT_END;

+		// ´òÓ¡¹«Ô¿

+		#if 1

+		strLog[0] = '\0';

+		for (i = 0; i < 16; i++)

+		{

+			sprintf(strValue, "%08lX", otpInfo.pubKey[i]);

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "OTP Public key1: %s\n", strLog);

+

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 16; i < 32; i++)

+		{

+			sprintf(strValue, "%08lX", otpInfo.pubKey[i]);

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "OTP Public key2: %s\n", strLog);

+

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 32; i < 48; i++)

+		{

+			sprintf(strValue, "%08lX", otpInfo.pubKey[i]);

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "OTP Public key3: %s\n", strLog);

+

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 48; i < 64; i++)

+		{

+			sprintf(strValue, "%08lX", otpInfo.pubKey[i]);

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "OTP Public key4: %s\n", strLog);

+

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 64; i < 80; i++)

+		{

+			sprintf(strValue, "%08lX", otpInfo.pubKey[i]);

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "OTP Public key5: %s\n", strLog);

+

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 80; i < sizeof(otpInfo.pubKey)/sizeof(UINT32); i++)

+		{

+			sprintf(strValue, "%08lX", otpInfo.pubKey[i]);

+			strcat(strLog, strValue);

+		}

+

+		at_print(AT_ERR, "OTP Public key6: %s\n", strLog);

+		#endif

+		//¼ÆË㹫ԿhashÖµ

+	    StrSHA256((const unsigned char*)otpInfo.pubKey, sizeof(otpInfo.pubKey), (unsigned char*)pubKeyHash_otp);

+	    // ´òÓ¡¹«Ô¿hash

+		memset(strLog, 0, sizeof(strLog));

+		for (i = 0; i < sizeof(pubKeyHash_otp)/sizeof(UINT32); i++)

+		{

+			sprintf(strValue, "%08lX", pubKeyHash_otp[i]);

+			strcat(strLog, strValue);

+		}

+

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

+

+		#if 1

+		

+		/*************************½«°²È«ÐÅϢдÈëotp**************************/

+		

+		if (memcmp(otpInfo.pubKeyHash, pubKeyHash_otp, sizeof(pubKeyHash_otp)) != 0)

+		{

+			// ¹«Ô¿hashֵдÈëotp

+			if (ioctl(otp_fd , OTP_SET_PUB_KEY_HASH, pubKeyHash_otp) != 0)

+			{

+		    	at_print(AT_ERR, "Write public key hash to otp fail!\n");

+				*res_msg = at_err_build(ATERR_PROC_FAILED);

+				*res_msglen = strlen(*res_msg);

+				close(otp_fd);

+				return AT_END;

+			}

+			else

+			{

+				at_print(AT_NORMAL, "Write public key hash to otp success!\n");

+			}

+	    }

+		else

+		{

+			at_print(AT_NORMAL, "Public key's hash value in otp already exists!\n");

+		}

+

+		/*************************ÅжÏдÈëµÄ¹«Ô¿hashÖµÊÇ·ñÕýÈ·**************************/

+	    // ´Óotp¶ÁÈ¡

+		memset(&otpInfo, 0, sizeof(otpInfo));

+	    if(ioctl(otp_fd , OTP_GET_DATA, &otpInfo)!= 0)

+		{

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

+			*res_msg = at_err_build(ATERR_PROC_FAILED);

+			*res_msglen = strlen(*res_msg);

+			close(otp_fd);

+			return AT_END;

+		}

+		 //±£Ö¤Ç°Ã湫Կhashֵд³É¹¦ÁË£¬ÔÙдÈ밲ȫboot flag

+		if (memcmp(otpInfo.pubKeyHash, pubKeyHash_otp, sizeof(pubKeyHash_otp)) != 0)

+	    {

+	        at_print(AT_ERR, "Public key hash in otp is not consistent!\n");

+	        *res_msg = at_err_build(ATERR_PROC_FAILED);

+	        *res_msglen = strlen(*res_msg);

+			close(otp_fd);

+	        return AT_END;

+	    }

+		#endif

+

+		#if 1

+		

+		/*efuseInfo.secureFlagÇ°Ãæ3¸ö×Ö½ÚÊÇchip flag,×îºóÒ»¸ö×Ö½ÚÊǰ²È«Ê¹ÄܱêÖ¾*/

+		

+	    if ((otpInfo.secureFlag&0xff) != secureFlag_otp)

+	    {

+	        // ʹÄܱêʶλдÈëotp

+	        if (ioctl(otp_fd , OTP_SET_SECURE_EN, &secureFlag_otp) != 0)

+	        {

+	            at_print(AT_ERR, "Write security flag to otp fail!\n");

+	            *res_msg = at_err_build(ATERR_PROC_FAILED);

+	            *res_msglen = strlen(*res_msg);

+				close(otp_fd);

+	            return AT_END;

+	        }

+	        else

+	        {

+	            at_print(AT_NORMAL, "Write security flag to otp success!\n");

+	        }

+	    }

+		else

+	    {

+	        at_print(AT_NORMAL, "Secure flag already exists!\n");

+	    }

+		

+	    /*************************ÅжÏдÈëµÄsecure flagÊÇ·ñÕýÈ·**************************/

+	    // ´Óotp¶ÁÈ¡

+	    memset(&otpInfo, 0, sizeof(otpInfo));

+	    if(ioctl(otp_fd , OTP_GET_DATA, &otpInfo)!= 0)

+	    {

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

+			*res_msg = at_err_build(ATERR_PROC_FAILED);

+			*res_msglen = strlen(*res_msg);

+			close(otp_fd);

+			return AT_END;

+	    }

+

+	    if ((otpInfo.secureFlag&0xff) != secureFlag_otp)

+	    {

+	        at_print(AT_ERR, "Security flag(%#08X) is not consistent!\n", otpInfo.secureFlag);

+	        *res_msg = at_err_build(ATERR_PROC_FAILED);

+	        *res_msglen = strlen(*res_msg);

+			close(otp_fd);

+	        return AT_END;

+	    }

+

+		#endif

+

+	    *res_msg = at_query_result_build("write security infomation", NULL);

+	    *res_msglen = strlen(*res_msg);

+		close(otp_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;

+    

+	T_ZDrvOtp_Secure otpInfo = {{0}};

+	int otp_fd = -1;

+    int is_Enhanced_Security = -1;

+

+	is_Enhanced_Security = IsEnhancedSecurity();

+	at_print(AT_ERR,"is_Enhanced_Security = %d.\n",is_Enhanced_Security);

+	if(is_Enhanced_Security == -1)

+	{

+		at_print(AT_ERR,"IsEnhancedSecurity() fail.\n");

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen(*res_msg);

+		return AT_END;

+	}

+	

+    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);

+		if(is_Enhanced_Security == 0)

+		{

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

+            *res_msglen = strlen(*res_msg);

+		    return AT_END;

+		}

+	} 

+

+	#if 1

+	

+    if(is_Enhanced_Security == 1)

+    {

+		otp_fd = open("/dev/otp", O_RDWR);

+		if (otp_fd < 0) 

+		{

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

+			*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/otp");

+

+		 // ´Óotp¶ÁÈ¡

+	    if(ioctl(otp_fd , OTP_GET_DATA, &otpInfo)!= 0)

+	    {

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

+			*res_msg = at_err_build(ATERR_PROC_FAILED);

+			*res_msglen = strlen(*res_msg);

+			close(otp_fd);

+			return AT_END;

+	    }

+		else

+		{		

+			memset(strLog, 0, sizeof(strLog));

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

+			strcat(strLog, strValue);

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

+	    	{

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

+	        	strcat(strLog, strValue);

+	    	}

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

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

+	        *res_msglen = strlen(*res_msg);

+			close(otp_fd);

+		    return AT_END;

+		} 

+    }

+	#endif

+	

+}

+

+

 /*

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

 {

@@ -2130,5 +2674,7 @@
     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;

 }

diff --git a/ap/lib/libcpnv/Makefile b/ap/lib/libcpnv/Makefile
index 88990b8..489cb8c 100755
--- a/ap/lib/libcpnv/Makefile
+++ b/ap/lib/libcpnv/Makefile
@@ -9,14 +9,19 @@
 
 OBJS = cpnv.o
 
+ifeq ($(USE_NVRO_BACKUP),yes)
+OBJS += nvro.o mtd.o file.o
+endif
+
 CFLAGS += -g -Werror=implicit-function-declaration
 #LDFLAGS += -lpthread
 ##############USER COMIZE END##################
 
 CFLAGS += -I$(APP_DIR)/include
 #CFLAGS += -I$(TOPDIR)/pub/project/$(CHIP_NAME)/include/nv
-CFLAGS += -I$(LINUX_DIR)/include
+#CFLAGS += -I$(LINUX_DIR)/include
 CFLAGS += -I$(zte_lib_path)/libnvram
+CFLAGS += -I$(zte_lib_path)/libssl/install/include
 CFLAGS += -fPIC
 LDFLAGS += -shared
 
diff --git a/ap/lib/libcpnv/file.c b/ap/lib/libcpnv/file.c
new file mode 100755
index 0000000..939ce20
--- /dev/null
+++ b/ap/lib/libcpnv/file.c
@@ -0,0 +1,157 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+
+#define  FAST_FUNC
+
+ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count)
+{
+	ssize_t n;
+
+	for (;;) {
+		n = read(fd, buf, count);
+		if (n >= 0 || errno != EINTR)
+			break;
+		/* Some callers set errno=0, are upset when they see EINTR.
+		 * Returning EINTR is wrong since we retry read(),
+		 * the "error" was transient.
+		 */
+		errno = 0;
+		/* repeat the read() */
+	}
+
+	return n;
+}
+
+/*
+ * Read all of the supplied buffer from a file.
+ * This does multiple reads as necessary.
+ * Returns the amount read, or -1 on an error.
+ * A short read is returned on an end of file.
+ */
+ssize_t FAST_FUNC full_read(int fd, void *buf, size_t len)
+{
+	ssize_t cc;
+	ssize_t total;
+
+	total = 0;
+
+	while (len) {
+		cc = safe_read(fd, buf, len);
+
+		if (cc < 0) {
+			if (total) {
+				/* we already have some! */
+				/* user can do another read to know the error code */
+				return total;
+			}
+			return cc; /* read() returns -1 on failure. */
+		}
+		if (cc == 0)
+			break;
+		buf = ((char *)buf) + cc;
+		total += cc;
+		len -= cc;
+	}
+
+	return total;
+}
+
+ssize_t FAST_FUNC read_close(int fd, void *buf, size_t size)
+{
+	/*int e;*/
+	size = full_read(fd, buf, size);
+	/*e = errno;*/
+	close(fd);
+	/*errno = e;*/
+	return size;
+}
+
+ssize_t FAST_FUNC open_read_close(const char *filename, void *buf, size_t size)
+{
+#ifdef ZXIC_WIN
+	int fd = open(filename, O_RDONLY | O_BINARY);
+#else
+	int fd = open(filename, O_RDONLY);
+#endif
+	if (fd < 0)
+		return fd;
+	return read_close(fd, buf, size);
+}
+
+ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count)
+{
+	ssize_t n;
+
+	for (;;) {
+		n = write(fd, buf, count);
+		if (n >= 0 || errno != EINTR)
+			break;
+		/* Some callers set errno=0, are upset when they see EINTR.
+		 * Returning EINTR is wrong since we retry write(),
+		 * the "error" was transient.
+		 */
+		errno = 0;
+		/* repeat the write() */
+	}
+
+	return n;
+}
+
+ssize_t FAST_FUNC full_write(int fd, const void *buf, size_t len)
+{
+	ssize_t cc;
+	ssize_t total;
+
+	total = 0;
+
+	while (len) {
+		cc = safe_write(fd, buf, len);
+
+		if (cc < 0) {
+			if (total) {
+				/* we already wrote some! */
+				/* user can do another write to know the error code */
+				return total;
+			}
+			return cc;  /* write() returns -1 on failure. */
+		}
+
+		total += cc;
+		buf = ((const char *)buf) + cc;
+		len -= cc;
+	}
+
+	return total;
+}
+
+ssize_t FAST_FUNC open_write_close(const char *filename, void *buf, size_t size)
+{
+	ssize_t ret;
+#ifdef ZXIC_WIN
+	int fd_to = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0640);
+#else
+	int fd_to = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, 0640);
+#endif
+
+	if(fd_to < 0)
+		return -1;
+	
+	ret = full_write(fd_to, buf, size);
+	fsync(fd_to);
+	close(fd_to);
+
+	return ret;
+}
diff --git a/ap/lib/libcpnv/mtd.c b/ap/lib/libcpnv/mtd.c
new file mode 100755
index 0000000..61be26d
--- /dev/null
+++ b/ap/lib/libcpnv/mtd.c
@@ -0,0 +1,129 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/vfs.h>
+
+
+#include <mtd/mtd-abi.h>
+#include <errno.h>
+
+#include <sys/ioctl.h>
+#include "mtd.h"
+
+
+int mtd_find(const char *i_parti_name, char *o_mtd_path, device_type_t device_type, unsigned int o_mtd_path_len)
+{
+	FILE *fd_mtd = 0;
+	char buf[128];
+	char *line_str;
+
+	if (!o_mtd_path_len)
+		return -1;
+
+	fd_mtd = fopen("/proc/mtd", "r+");
+	if (NULL == fd_mtd) {
+		printf("fs_check open file error:%s", strerror(errno));
+		//sc_debug_info_record(MODULE_ID_AP_FS_CHECK, "fs_check open file error:%s", strerror(errno));
+		goto error0;
+	}
+	//printf("fs_check partition name:%s\n", i_parti_name);
+
+	while (1) {
+		int matches = 0;
+		char mtdname[64] = {0};
+		int  mtdnum = 0;
+		unsigned int  mtdsize, mtderasesize;
+        memset(buf, 0x00, sizeof(buf));
+		line_str = fgets(buf, sizeof(buf), fd_mtd);
+
+		if (NULL == line_str) {
+			printf("fs_check get info from mtd error:%s\n", strerror(errno));
+			//sc_debug_info_record(MODULE_ID_AP_FS_CHECK, "fs_check get info from mtd error:%s\n", strerror(errno));
+			goto error1;
+		}
+		//mtd5: 00100000 00020000 "fotaflag"
+		matches = sscanf(buf, "mtd%d: %x %x \"%63[^\"]",
+		                 &mtdnum, &mtdsize, &mtderasesize, mtdname);
+		mtdname[63] = '\0';
+		
+		if ((matches == 4) && (strcmp(mtdname, i_parti_name) == 0)) {
+			memset(o_mtd_path, 0x00, o_mtd_path_len);
+			if (device_type == DEVICE_MTD_BLOCK) {
+				snprintf(o_mtd_path, o_mtd_path_len, "/dev/mtdblock%d", mtdnum);
+			} else if (device_type == DEVICE_MTD) {
+				snprintf(o_mtd_path, o_mtd_path_len, "/dev/mtd%d", mtdnum);
+			} else if (device_type == DEVICE_ZFTL) {
+				snprintf(o_mtd_path, o_mtd_path_len, "/dev/zftl%d", mtdnum);
+			} else {
+				printf("fs_check unknown device type %d\n", device_type);
+				//sc_debug_info_record(MODULE_ID_AP_FS_CHECK, "fs_check unknown device type %d\n", device_type);
+				goto error1;
+			}
+			//printf("fs_check o_mtd_path=[%s]\n", o_mtd_path);
+			break;
+		}
+
+	}
+	fclose(fd_mtd);
+	return 0;
+
+error1:
+	fclose(fd_mtd);
+error0:
+	return -1;
+}
+
+int mtd_erase_partition(const char* partition_name)
+{
+	int ret = 0;
+	char mtd_path[MAX_PATH] = {0};
+	int fd_mtd = -1;
+
+	struct mtd_info_user meminfo = {0};
+	struct erase_info_user64 erase_info = {0};
+
+	if (NULL == partition_name) {
+		return -1;
+	}
+	ret = mtd_find(partition_name, mtd_path, DEVICE_MTD, MAX_PATH);
+	if (ret < 0) {
+		printf("fs_check mtd_find %s failed\n", partition_name);
+		//sc_debug_info_record(MODULE_ID_AP_FS_CHECK, "fs_check mtd_find %s failed\n", partition_name);
+		ret = -1;
+		goto out;
+	}
+	fd_mtd = open(mtd_path, O_RDWR);
+	if (fd_mtd < 0) {
+		printf("fs_check open %s error, %s\n", partition_name, strerror(errno));
+		//sc_debug_info_record(MODULE_ID_AP_FS_CHECK, "fs_check open %s error, %s\n", partition_name, strerror(errno));
+		ret = -1;
+		goto out;
+	}
+	if (ioctl(fd_mtd, MEMGETINFO, &meminfo) != 0) {
+		printf("fs_check get %s info error, %s\n", partition_name, strerror(errno));
+		//sc_debug_info_record(MODULE_ID_AP_FS_CHECK, "fs_check get %s info error, %s\n", partition_name, strerror(errno));
+		ret = -1;
+		goto out;
+	}
+	erase_info.length = meminfo.erasesize;
+	for (erase_info.start = 0; erase_info.start < meminfo.size; erase_info.start += meminfo.erasesize) {
+		if (ioctl(fd_mtd, MEMGETBADBLOCK, &(erase_info.start)) > 0) {
+			printf("fs_check mtd, not erasing bad block at 0x%llx\n", erase_info.start);
+			continue;
+		}
+		if (ioctl(fd_mtd, MEMERASE64, &erase_info) < 0) {
+			printf("fs_check mtd, erasing failure at 0x%llx\n", erase_info.start);
+		}
+	}
+	ret = 0;
+out:
+	if (fd_mtd >= 0) {
+		close(fd_mtd);
+	}
+	return ret;
+}
diff --git a/ap/lib/libcpnv/mtd.h b/ap/lib/libcpnv/mtd.h
new file mode 100755
index 0000000..a517ad0
--- /dev/null
+++ b/ap/lib/libcpnv/mtd.h
@@ -0,0 +1,16 @@
+#ifndef __CPNV_MTD_H
+#define __CPNV_MTD_H
+
+typedef enum {
+	DEVICE_MTD = 0,
+	DEVICE_ZFTL = 1,
+	DEVICE_MTD_BLOCK,
+} device_type_t;
+
+#define MAX_PATH 					(256)
+
+
+extern int mtd_find(const char *i_parti_name, char *o_mtd_path, device_type_t device_type, unsigned int o_mtd_path_len);
+extern int mtd_erase_partition(const char* partition_name);
+
+#endif
diff --git a/ap/lib/libcpnv/nvro.c b/ap/lib/libcpnv/nvro.c
new file mode 100755
index 0000000..0e5880c
--- /dev/null
+++ b/ap/lib/libcpnv/nvro.c
@@ -0,0 +1,338 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "openssl/md5.h"
+#include "mtd.h"
+#include "libcpnv.h"
+#include "cfg_api.h"
+#include "flags_api.h"
+#include "zxicbasic_api.h"
+
+
+/*******************************************************************************
+* 功能描述:     copyfile
+* 参数说明:     
+*   (传入参数)  to:目标文件
+*   (传入参数)  from:源文件
+* 返 回 值:     0表示成功,负值失败
+* 其它说明:     
+*******************************************************************************/
+static int copyfile(const char *from, const char *to)
+{
+    int fd_to;
+    int fd_from;
+    char buf[4096];
+    ssize_t nread;
+    int ret = -1;
+
+    fd_from = open(from, O_RDONLY);
+    if (fd_from < 0)
+        return -2;
+
+    fd_to = open(to, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, 0640);
+    if (fd_to < 0) {
+        ret = -3;
+        goto out_error;
+    }
+
+    while (1)
+    {
+        char *out_ptr;
+        ssize_t nwritten;
+
+        nread = read(fd_from, buf, sizeof(buf));
+        if (nread == 0)
+        {
+            break; /* read file done*/
+        }
+        else
+        {
+            if (nread < 0 )
+            {
+                if (errno == EINTR || errno == EAGAIN)
+                {
+                    continue;
+                }
+                else
+                {
+                    ret = -4;
+                    goto out_error;
+                }
+            }
+        }
+
+        out_ptr = buf;
+        do
+        {
+            nwritten = write(fd_to, out_ptr, nread);
+            if (nwritten > 0)
+            {
+                nread -= nwritten;
+                out_ptr += nwritten;
+            }
+            else
+            {
+                if (nwritten < 0)
+                {
+                    if (errno == EINTR || errno == EAGAIN)
+                    {
+                        continue;
+                    }
+                    else
+                    {
+                        ret = -5;
+                        goto out_error;
+                    }
+                }
+            }
+        } while (nread > 0);
+    }
+
+    ret = fsync(fd_to);
+	if (ret < 0) {
+		printf("Sync Failed:%s, file path:%s", strerror(errno), to);
+		goto out_error;
+	}
+	
+    if (close(fd_to) < 0)
+    {
+        fd_to = -1;
+        ret = -6;
+        goto out_error;
+    }
+    close(fd_from);
+
+    /* Success! */
+    return 0;
+
+out_error:
+    printf("copyfile %s to %s error:%d\n", from, to, ret);
+    close(fd_from);
+    if (fd_to >= 0)
+        close(fd_to);
+
+    return ret;
+}
+
+int nvrofs2_mount(int rw)
+{
+    if (rw)
+        return zxic_system("/bin/mount -t jffs2 -o rw,sync mtd:nvrofs2 /mnt/nvrofs2");
+    else
+        return zxic_system("/bin/mount -t jffs2 -o ro mtd:nvrofs2 /mnt/nvrofs2");
+}
+int nvrofs2_umount(void)
+{
+    return zxic_system("/bin/umount -f -l /mnt/nvrofs2");
+}
+
+unsigned char *bin2hex(const unsigned char *old, const size_t oldlen)
+{
+    unsigned char *result = (unsigned char *)malloc(oldlen * 2 + 1);
+    size_t i, j;
+    int b = 0;
+
+    for (i = j = 0; i < oldlen; i++)
+    {
+        b = old[i] >> 4;
+        result[j++] = (char)(87 + b + (((b - 10) >> 31) & -39));
+        b = old[i] & 0xf;
+        result[j++] = (char)(87 + b + (((b - 10) >> 31) & -39));
+    }
+    result[j] = '\0';
+    return result;
+}
+
+int calc_file_hash(const char *file_in, unsigned char *hash_value)
+{
+    MD5_CTX ctx;
+    unsigned char *buf;
+    int offset;
+    int fd;
+    ssize_t len;
+    
+    fd = open(file_in, O_RDONLY);
+    if (fd < 0)
+        return -1;
+    buf = malloc(4096);
+    if (buf == NULL)
+        return -1;
+    MD5_Init(&ctx);
+    do
+    {
+        len = full_read(fd, buf, 4096);
+        MD5_Update(&ctx, buf, len);
+        if (len < 4096)
+            break;
+    } while(1);
+
+    MD5_Final(hash_value, &ctx);
+    free(buf);
+    return 0;
+}
+
+int file_hash(const char *file_in, const char *file_hash)
+{
+    unsigned char hash_value[16] = {0};
+    unsigned char *hash_str;
+    int ret;
+    ssize_t ret_s;
+
+    ret = calc_file_hash(file_in, hash_value);
+    if (ret < 0)
+        return -1;
+    hash_str = bin2hex(hash_value, 16);
+    ret_s = open_write_close(file_hash, hash_str, 32);
+    free(hash_str);
+    if (ret_s != 32)
+        return -1;
+    return 0;
+}
+int file_hash_check(const char *file_in, const char *file_hash)
+{
+    unsigned char hash_value[16] = {0};
+    unsigned char *hash_str;
+    unsigned char  hash_str2[33] = {0};
+    int ret;
+    ssize_t ret_s;
+
+    ret = calc_file_hash(file_in, hash_value);
+    if (ret < 0)
+        return -1;
+    hash_str = bin2hex(hash_value, 16);
+    memset(hash_str2, 0, sizeof(hash_str2));
+    ret_s = open_read_close(file_hash, hash_str2, 32);
+    if (ret_s != 32)
+        return -1;
+    if (strcmp(hash_str, hash_str2) == 0)
+    {
+        return 0;
+    }
+    return -1;
+}
+
+unsigned int cpnv_NvroBackup(void)
+{
+    char mtd_path[MAX_PATH] = {0};
+    int ret;
+
+    ret = mtd_find("nvrofs2", mtd_path, DEVICE_MTD_BLOCK, MAX_PATH);
+    if (ret < 0)
+    {
+        printf("[error]cpnv can not find nvrofs2\n");
+        return CPNV_ERROR;
+    }
+    ret = mtd_erase_partition("nvrofs2");
+    if (ret != 0)
+    {
+        printf("[error]cpnv erase nvrofs2\n");
+        return CPNV_ERROR;
+    }
+    
+    nvrofs2_umount();
+    ret = nvrofs2_mount(1);
+    if (ret != 0)
+    {
+        printf("[error]cpnv nvrofs2_mount\n");
+        return CPNV_ERROR;
+    }
+    ret = copyfile("/mnt/nvrofs/nvroall.bin", "/mnt/nvrofs2/nvroall.bin");
+    if (ret != 0)
+    {
+        printf("[error]cpnv nvrofs2 copyfile\n");
+        goto out_err;
+    }
+    ret = file_hash("/mnt/nvrofs2/nvroall.bin", "/mnt/nvrofs2/nvroall.bin.hash");
+    if (ret != 0)
+    {
+        printf("[error]cpnv file_hash\n");
+        goto out_err;
+    }
+    ret = nvrofs2_umount();
+    if (ret < 0)
+    {
+        printf("[error]cpnv nvrofs2_umount\n");
+        return CPNV_ERROR;
+    }
+
+    ret = flags_set_nvroflag(NVRO_BACKED_UP);
+    if (ret != 0)
+    {
+        printf("[error]cpnv NVRO_BACKED_UP\n");
+        return CPNV_ERROR;
+    }
+    return CPNV_OK;
+
+out_err:
+    nvrofs2_umount();
+
+    return CPNV_ERROR;
+}
+
+unsigned int cpnv_NvroRestore(void)
+{
+    int ret;
+    unsigned int ret_u;
+    unsigned int nvro_flag;
+
+    nvro_flag = flags_get_nvroflag();
+    if (nvro_flag != NVRO_RESTORING)
+    {
+        printf("[error]cpnv_NvroRestore nvro flag error\n");
+        return CPNV_ERROR;
+    }
+    nvrofs2_umount();
+    ret = nvrofs2_mount(0);
+    if (ret != 0)
+    {
+        printf("[error]cpnv nvrofs2_mount\n");
+        return CPNV_ERROR;
+    }
+    ret = file_hash_check("/mnt/nvrofs2/nvroall.bin", "/mnt/nvrofs2/nvroall.bin.hash");
+    if (ret != 0)
+    {
+        printf("[error]cpnv file_hash_check\n");
+        goto out_err;
+    }
+    ret_u = cpnv_ChangeFsPartitionAttr(FS_NVROFS, 1);
+    if (ret_u != CPNV_OK)
+    {
+        printf("[error]cpnv nvrofs Attr 1\n");
+        goto out_err;
+    }
+    ret = copyfile("/mnt/nvrofs2/nvroall.bin", "/mnt/nvrofs/nvroall.bin");
+    if (ret != 0)
+    {
+        printf("[error]cpnv nvrofs2 restore copyfile\n");
+        goto out_err;
+    }
+	ret_u = cpnv_ChangeFsPartitionAttr(FS_NVROFS, 0);
+    if (ret_u != CPNV_OK)
+    {
+        printf("[error]cpnv nvrofs Attr 0\n");
+        goto out_err;
+    }
+    ret = nvrofs2_umount();
+    if (ret < 0)
+    {
+        printf("[error]cpnv nvrofs2_umount\n");
+        return CPNV_ERROR;
+    }
+    ret = flags_set_nvroflag(NVRO_BACKED_UP);
+    if (ret != 0)
+    {
+        printf("[error]cpnv_NvroRestore set NVRO_BACKED_UP\n");
+        return CPNV_ERROR;
+    }
+    return CPNV_OK;
+
+out_err:
+    nvrofs2_umount();
+
+    return CPNV_ERROR;
+}
diff --git a/ap/lib/libcpnv/zxicbasic_api.h b/ap/lib/libcpnv/zxicbasic_api.h
new file mode 100755
index 0000000..60b6824
--- /dev/null
+++ b/ap/lib/libcpnv/zxicbasic_api.h
@@ -0,0 +1,13 @@
+
+#ifndef __ZXICBASIC_API_H
+#define __ZXICBASIC_API_H
+
+extern ssize_t  safe_read(int fd, void *buf, size_t count);
+extern ssize_t  full_read(int fd, void *buf, size_t len);
+extern ssize_t  read_close(int fd, void *buf, size_t size);
+extern ssize_t  open_read_close(const char *filename, void *buf, size_t size);
+extern ssize_t  safe_write(int fd, const void *buf, size_t count);
+extern ssize_t  full_write(int fd, const void *buf, size_t len);
+extern ssize_t  open_write_close(const char *filename, void *buf, size_t size);
+
+#endif
\ No newline at end of file
diff --git a/ap/lib/libcurl/curl-7.86.0/include/curl/curl.h b/ap/lib/libcurl/curl-7.86.0/include/curl/curl.h
index e28dd0b..a5a5a0a 100755
--- a/ap/lib/libcurl/curl-7.86.0/include/curl/curl.h
+++ b/ap/lib/libcurl/curl-7.86.0/include/curl/curl.h
@@ -2885,6 +2885,7 @@
   CURL_LOCK_DATA_SSL_SESSION,
   CURL_LOCK_DATA_CONNECT,
   CURL_LOCK_DATA_PSL,
+  CURL_LOCK_DATA_HSTS,//BDSA-2023-0305 //BDSA-2023-0312
   CURL_LOCK_DATA_LAST
 } curl_lock_data;
 
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/content_encoding.c b/ap/lib/libcurl/curl-7.86.0/lib/content_encoding.c
index bfc13e2..75ec574 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/content_encoding.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/content_encoding.c
@@ -1045,7 +1045,6 @@
                                      const char *enclist, int maybechunked)
 {
   struct SingleRequest *k = &data->req;
-  int counter = 0;
 
   do {
     const char *name;
@@ -1079,10 +1078,10 @@
 
       if(!encoding)
         encoding = &error_encoding;  /* Defer error at stack use. */
-
-      if(++counter >= MAX_ENCODE_STACK) {
-        failf(data, "Reject response due to %u content encodings",
-              counter);
+//BDSA-2023-0316
+      if(k->writer_stack_depth++ >= MAX_ENCODE_STACK) {
+        failf(data, "Reject response due to more than %u content encodings",
+              MAX_ENCODE_STACK);
         return CURLE_BAD_CONTENT_ENCODING;
       }
       /* Stack the unencoding stage. */
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/hsts.c b/ap/lib/libcurl/curl-7.86.0/lib/hsts.c
index e3b686e..a5c13e6 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/hsts.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/hsts.c
@@ -40,6 +40,7 @@
 #include "fopen.h"
 #include "rename.h"
 #include "strtoofft.h"
+#include "share.h"//BDSA-2023-0305
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -426,14 +427,23 @@
   if(2 == rc) {
     time_t expires = strcmp(date, UNLIMITED) ? Curl_getdate_capped(date) :
       TIME_T_MAX;
-    CURLcode result;
+    CURLcode result = CURLE_OK;//BDSA-2023-0312
     char *p = host;
     bool subdomain = FALSE;
+    struct stsentry *e;
     if(p[0] == '.') {
       p++;
       subdomain = TRUE;
     }
-    result = hsts_create(h, p, subdomain, expires);
+    /* only add it if not already present */
+    e = Curl_hsts(h, p, subdomain);
+    if(!e)
+      result = hsts_create(h, p, subdomain, expires);
+    else {
+      /* the same host name, use the largest expire time */
+      if(expires > e->expires)
+        e->expires = expires;
+    }
     if(result)
       return result;
   }
@@ -551,5 +561,19 @@
     return hsts_pull(data, h);
   return CURLE_OK;
 }
+//BDSA-2023-0305
+void Curl_hsts_loadfiles(struct Curl_easy *data)
+{
+  struct curl_slist *l = data->set.hstslist;
+  if(l) {
+    Curl_share_lock(data, CURL_LOCK_DATA_HSTS, CURL_LOCK_ACCESS_SINGLE);
+
+    while(l) {
+      (void)Curl_hsts_loadfile(data, data->hsts, l->data);
+      l = l->next;
+    }
+    Curl_share_unlock(data, CURL_LOCK_DATA_HSTS);
+  }
+}
 
 #endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/hsts.h b/ap/lib/libcurl/curl-7.86.0/lib/hsts.h
index 0e36a77..fd7ae77 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/hsts.h
+++ b/ap/lib/libcurl/curl-7.86.0/lib/hsts.h
@@ -59,9 +59,11 @@
                             struct hsts *h, const char *file);
 CURLcode Curl_hsts_loadcb(struct Curl_easy *data,
                           struct hsts *h);
+void Curl_hsts_loadfiles(struct Curl_easy *data);//BDSA-2023-0305 //BDSA-2023-0312
 #else
 #define Curl_hsts_cleanup(x)
 #define Curl_hsts_loadcb(x,y) CURLE_OK
 #define Curl_hsts_save(x,y,z)
+#define Curl_hsts_loadfiles(x)
 #endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */
 #endif /* HEADER_CURL_HSTS_H */
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/http.c b/ap/lib/libcurl/curl-7.86.0/lib/http.c
index f57859e..1063598 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/http.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/http.c
@@ -3724,8 +3724,8 @@
 #endif
             )) {
     CURLcode check =
-      Curl_hsts_parse(data->hsts, data->state.up.hostname,
-                      headp + strlen("Strict-Transport-Security:"));
+      Curl_hsts_parse(data->hsts, conn->host.name,
+                      headp + strlen("Strict-Transport-Security:"));//CVE-2022-43551(BDSA-2022-3659)
     if(check)
       infof(data, "Illegal STS header skipped");
 #ifdef DEBUGBUILD
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/setopt.c b/ap/lib/libcurl/curl-7.86.0/lib/setopt.c
index 5b59754..a83dc3d 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/setopt.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/setopt.c
@@ -2250,10 +2250,15 @@
       if(data->share->cookies == data->cookies)
         data->cookies = NULL;
 #endif
-
+//BDSA-2023-0305
+#ifndef CURL_DISABLE_HSTS
+      if(data->share->hsts == data->hsts)
+        data->hsts = NULL;
+#endif
+#ifdef USE_SSL
       if(data->share->sslsession == data->state.session)
         data->state.session = NULL;
-
+#endif
 #ifdef USE_LIBPSL
       if(data->psl == &data->share->psl)
         data->psl = data->multi? &data->multi->psl: NULL;
@@ -2287,10 +2292,20 @@
         data->cookies = data->share->cookies;
       }
 #endif   /* CURL_DISABLE_HTTP */
+//BDSA-2023-0305
+#ifndef CURL_DISABLE_HSTS
+      if(data->share->hsts) {
+        /* first free the private one if any */
+        Curl_hsts_cleanup(&data->hsts);
+        data->hsts = data->share->hsts;
+      }
+#endif   /* CURL_DISABLE_HTTP */
+#ifdef USE_SSL
       if(data->share->sslsession) {
         data->set.general_ssl.max_ssl_sessions = data->share->max_ssl_sessions;
         data->state.session = data->share->sslsession;
       }
+#endif
 #ifdef USE_LIBPSL
       if(data->share->specifier & (1 << CURL_LOCK_DATA_PSL))
         data->psl = &data->share->psl;
@@ -2505,7 +2520,15 @@
     result = Curl_setstropt(&data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5],
                             va_arg(param, char *));
     break;
-
+//BDSA-2023-0018
+  case CURLOPT_SSH_KNOWNHOSTS:
+    /*
+     * Store the file name to read known hosts from.
+     */
+    result = Curl_setstropt(&data->set.str[STRING_SSH_KNOWNHOSTS],
+                            va_arg(param, char *));
+    break;
+#ifdef USE_LIBSSH2
   case CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256:
     /*
      * Option to allow for the SHA256 of the host public key to be checked
@@ -2515,14 +2538,6 @@
                             va_arg(param, char *));
     break;
 
-  case CURLOPT_SSH_KNOWNHOSTS:
-    /*
-     * Store the file name to read known hosts from.
-     */
-    result = Curl_setstropt(&data->set.str[STRING_SSH_KNOWNHOSTS],
-                            va_arg(param, char *));
-    break;
-#ifdef USE_LIBSSH2
   case CURLOPT_SSH_HOSTKEYFUNCTION:
     /* the callback to check the hostkey without the knownhost file */
     data->set.ssh_hostkeyfunc = va_arg(param, curl_sshhostkeycallback);
@@ -3040,19 +3055,39 @@
   case CURLOPT_HSTSWRITEDATA:
     data->set.hsts_write_userp = va_arg(param, void *);
     break;
-  case CURLOPT_HSTS:
+  case CURLOPT_HSTS: {
+    struct curl_slist *h;
     if(!data->hsts) {
       data->hsts = Curl_hsts_init();
       if(!data->hsts)
         return CURLE_OUT_OF_MEMORY;
     }
     argptr = va_arg(param, char *);
-    result = Curl_setstropt(&data->set.str[STRING_HSTS], argptr);
-    if(result)
-      return result;
-    if(argptr)
-      (void)Curl_hsts_loadfile(data, data->hsts, argptr);
+    if(argptr) {
+      result = Curl_setstropt(&data->set.str[STRING_HSTS], argptr);
+      if(result)
+        return result;
+      /* this needs to build a list of file names to read from, so that it can
+         read them later, as we might get a shared HSTS handle to load them
+         into */
+      h = curl_slist_append(data->set.hstslist, argptr);
+      if(!h) {
+        curl_slist_free_all(data->set.hstslist);
+        data->set.hstslist = NULL;
+        return CURLE_OUT_OF_MEMORY;
+      }
+      data->set.hstslist = h; /* store the list for later use */
+    }
+    else {
+      /* clear the list of HSTS files */
+      curl_slist_free_all(data->set.hstslist);
+      data->set.hstslist = NULL;
+      if(!data->share || !data->share->hsts)
+        /* throw away the HSTS cache unless shared */
+        Curl_hsts_cleanup(&data->hsts);
+    }
     break;
+  }//BDSA-2023-0305
   case CURLOPT_HSTS_CTRL:
     arg = va_arg(param, long);
     if(arg & CURLHSTS_ENABLE) {
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/share.c b/ap/lib/libcurl/curl-7.86.0/lib/share.c
index 1a083e7..22bd4fd 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/share.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/share.c
@@ -29,6 +29,10 @@
 #include "share.h"
 #include "psl.h"
 #include "vtls/vtls.h"
+#include "hsts.h"//BDSA-2023-0305
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
 #include "curl_memory.h"
 
 /* The last #include file should be: */
@@ -88,6 +92,18 @@
       res = CURLSHE_NOT_BUILT_IN;
 #endif
       break;
+//BDSA-2023-0305
+    case CURL_LOCK_DATA_HSTS:
+#ifndef CURL_DISABLE_HSTS
+      if(!share->hsts) {
+        share->hsts = Curl_hsts_init();
+        if(!share->hsts)
+          res = CURLSHE_NOMEM;
+      }
+#else   /* CURL_DISABLE_HTTP */
+      res = CURLSHE_NOT_BUILT_IN;
+#endif
+      break;
 
     case CURL_LOCK_DATA_SSL_SESSION:
 #ifdef USE_SSL
@@ -140,6 +156,16 @@
       res = CURLSHE_NOT_BUILT_IN;
 #endif
       break;
+//BDSA-2023-0305
+    case CURL_LOCK_DATA_HSTS:
+#ifndef CURL_DISABLE_HSTS
+      if(share->hsts) {
+        Curl_hsts_cleanup(&share->hsts);
+      }
+#else   /* CURL_DISABLE_HTTP */
+      res = CURLSHE_NOT_BUILT_IN;
+#endif
+      break;
 
     case CURL_LOCK_DATA_SSL_SESSION:
 #ifdef USE_SSL
@@ -206,6 +232,10 @@
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
   Curl_cookie_cleanup(share->cookies);
 #endif
+//BDSA-2023-0305
+#ifndef CURL_DISABLE_HSTS
+  Curl_hsts_cleanup(&share->hsts);
+#endif
 
 #ifdef USE_SSL
   if(share->sslsession) {
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/share.h b/ap/lib/libcurl/curl-7.86.0/lib/share.h
index 32be416..18c79af 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/share.h
+++ b/ap/lib/libcurl/curl-7.86.0/lib/share.h
@@ -59,10 +59,15 @@
 #ifdef USE_LIBPSL
   struct PslCache psl;
 #endif
-
+//BDSA-2023-0305
+#ifndef CURL_DISABLE_HSTS
+  struct hsts *hsts;
+#endif
+#ifdef USE_SSL
   struct Curl_ssl_session *sslsession;
   size_t max_ssl_sessions;
   long sessionage;
+#endif
 };
 
 CURLSHcode Curl_share_lock(struct Curl_easy *, curl_lock_data,
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/smb.c b/ap/lib/libcurl/curl-7.86.0/lib/smb.c
index a62e858..4a44f5f 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/smb.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/smb.c
@@ -62,8 +62,6 @@
 static CURLcode smb_connection_state(struct Curl_easy *data, bool *done);
 static CURLcode smb_do(struct Curl_easy *data, bool *done);
 static CURLcode smb_request_state(struct Curl_easy *data, bool *done);
-static CURLcode smb_done(struct Curl_easy *data, CURLcode status,
-                         bool premature);
 static CURLcode smb_disconnect(struct Curl_easy *data,
                                struct connectdata *conn, bool dead);
 static int smb_getsock(struct Curl_easy *data, struct connectdata *conn,
@@ -78,7 +76,7 @@
   "SMB",                                /* scheme */
   smb_setup_connection,                 /* setup_connection */
   smb_do,                               /* do_it */
-  smb_done,                             /* done */
+  ZERO_NULL,                            /* done */ //BDSA-2022-3660
   ZERO_NULL,                            /* do_more */
   smb_connect,                          /* connect_it */
   smb_connection_state,                 /* connecting */
@@ -105,7 +103,7 @@
   "SMBS",                               /* scheme */
   smb_setup_connection,                 /* setup_connection */
   smb_do,                               /* do_it */
-  smb_done,                             /* done */
+  ZERO_NULL,                            /* done */ //BDSA-2022-3660
   ZERO_NULL,                            /* do_more */
   smb_connect,                          /* connect_it */
   smb_connection_state,                 /* connecting */
@@ -941,14 +939,6 @@
   return CURLE_OK;
 }
 
-static CURLcode smb_done(struct Curl_easy *data, CURLcode status,
-                         bool premature)
-{
-  (void) premature;
-  Curl_safefree(data->req.p.smb);
-  return status;
-}
-
 static CURLcode smb_disconnect(struct Curl_easy *data,
                                struct connectdata *conn, bool dead)
 {
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/telnet.c b/ap/lib/libcurl/curl-7.86.0/lib/telnet.c
index 923c7f8..e2157d8 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/telnet.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/telnet.c
@@ -1248,9 +1248,7 @@
 
   curl_slist_free_all(tn->telnet_vars);
   tn->telnet_vars = NULL;
-
-  Curl_safefree(data->req.p.telnet);
-
+  //BDSA-2022-3660
   return CURLE_OK;
 }
 
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/transfer.c b/ap/lib/libcurl/curl-7.86.0/lib/transfer.c
index 441da73..c16f336 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/transfer.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/transfer.c
@@ -1469,6 +1469,9 @@
   /* If there is a list of host pairs to deal with */
   if(data->state.resolve)
     result = Curl_loadhostpairs(data);
+//BDSA-2023-0305
+  /* If there is a list of hsts files to read */
+  Curl_hsts_loadfiles(data);
 
   if(!result) {
     /* Allow data->set.use_port to set which port to use. This needs to be
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/url.c b/ap/lib/libcurl/curl-7.86.0/lib/url.c
index be5ffca..62b86e0 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/url.c
+++ b/ap/lib/libcurl/curl-7.86.0/lib/url.c
@@ -445,7 +445,12 @@
   Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]);
   Curl_altsvc_cleanup(&data->asi);
   Curl_hsts_save(data, data->hsts, data->set.str[STRING_HSTS]);
-  Curl_hsts_cleanup(&data->hsts);
+  //BDSA-2023-0305
+#ifndef CURL_DISABLE_HSTS
+  if(!data->share || !data->share->hsts)
+    Curl_hsts_cleanup(&data->hsts);
+  curl_slist_free_all(data->set.hstslist); /* clean up list */
+#endif
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
   Curl_http_auth_cleanup_digest(data);
 #endif
diff --git a/ap/lib/libcurl/curl-7.86.0/lib/urldata.h b/ap/lib/libcurl/curl-7.86.0/lib/urldata.h
index 1d430b5..7b40cd9 100755
--- a/ap/lib/libcurl/curl-7.86.0/lib/urldata.h
+++ b/ap/lib/libcurl/curl-7.86.0/lib/urldata.h
@@ -709,6 +709,7 @@
   struct dohdata *doh; /* DoH specific data for this request */
 #endif
   unsigned char setcookies;
+  unsigned char writer_stack_depth; /* Unencoding stack depth. */ //BDSA-2023-0316
   BIT(header);        /* incoming data has HTTP header */
   BIT(content_range); /* set TRUE if Content-Range: was found */
   BIT(upload_done);   /* set to TRUE when doing chunked transfer-encoding
@@ -1700,6 +1701,9 @@
 
   void *seek_client;    /* pointer to pass to the seek callback */
 #ifndef CURL_DISABLE_HSTS
+//BDSA-2023-0305
+  struct curl_slist *hstslist; /* list of HSTS files set by
+                                  curl_easy_setopt(HSTS) calls */
   curl_hstsread_callback hsts_read;
   void *hsts_read_userp;
   curl_hstswrite_callback hsts_write;
diff --git a/ap/lib/libcurl/curl-7.86.0/src/tool_operate.c b/ap/lib/libcurl/curl-7.86.0/src/tool_operate.c
index 43c1c5e..662bc55 100755
--- a/ap/lib/libcurl/curl-7.86.0/src/tool_operate.c
+++ b/ap/lib/libcurl/curl-7.86.0/src/tool_operate.c
@@ -2691,6 +2691,7 @@
         curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
         curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
         curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_PSL);
+        curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_HSTS);//BDSA-2023-0312
 
         /* Get the required arguments for each operation */
         do {
diff --git a/ap/lib/libflags/flags_api.c b/ap/lib/libflags/flags_api.c
index 37653fc..151b5b3 100755
--- a/ap/lib/libflags/flags_api.c
+++ b/ap/lib/libflags/flags_api.c
@@ -500,7 +500,9 @@
 	dst->ubifs_status.fs_status = src->ubifs_status.fs_status;

 	strncpy(dst->ubifs_status.fs_mtd_name, src->ubifs_status.fs_mtd_name, sizeof(dst->ubifs_status.fs_mtd_name));

 	strncpy(dst->ubifs_status.fs_ubi_vol_name, src->ubifs_status.fs_ubi_vol_name, sizeof(dst->ubifs_status.fs_ubi_vol_name));

-	

+

+	dst->nvro_flag = src->nvro_flag;

+

 	dst->magic_end = src->magic_end;

 

 	return;

@@ -875,6 +877,35 @@
     return 0;

 }

 

+unsigned int flags_get_nvroflag(void)

+{

+	T_FLAGS_INFO t_flag = {0};

+

+	if (flags_get(&t_flag) != 0)

+		return NVRO_INVALID;

+	return t_flag.nvro_flag;

+}

+

+int flags_set_nvroflag(unsigned int flag)

+{

+	T_FLAGS_INFO t_flag = {0};

+

+	if (flags_get(&t_flag) != 0)

+		return -1;

+	if (t_flag.nvro_flag == flag)

+		return 0;

+	if (flag == NVRO_RESTORING)

+	{

+		if (t_flag.nvro_flag != NVRO_BACKED_UP)

+		{

+			printf("[error]flags nvro only NVRO_BACKED_UP switch to NVRO_RESTORING\n");

+			return -1;

+		}

+	}

+	t_flag.nvro_flag = flag;

+

+	return flags_set(&t_flag);

+}

 

 int flags_get_current_system()

 {

diff --git a/ap/lib/liblpa/libes10.a b/ap/lib/liblpa/libes10.a
index edad65b..08d9e2d 100755
--- a/ap/lib/liblpa/libes10.a
+++ b/ap/lib/liblpa/libes10.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram.a b/ap/lib/libnvram/libnvram.a
index f27ad59..c20b9c0 100755
--- a/ap/lib/libnvram/libnvram.a
+++ b/ap/lib/libnvram/libnvram.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram.so b/ap/lib/libnvram/libnvram.so
index b70fd1e..4c207ab 100755
--- a/ap/lib/libnvram/libnvram.so
+++ b/ap/lib/libnvram/libnvram.so
Binary files differ
diff --git a/ap/lib/libnvram/libnvram_sc.a b/ap/lib/libnvram/libnvram_sc.a
index 9c12166..00dd28d 100755
--- a/ap/lib/libnvram/libnvram_sc.a
+++ b/ap/lib/libnvram/libnvram_sc.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram_sc.so b/ap/lib/libnvram/libnvram_sc.so
index 9481e23..609cf5b 100755
--- a/ap/lib/libnvram/libnvram_sc.so
+++ b/ap/lib/libnvram/libnvram_sc.so
Binary files differ
diff --git a/ap/lib/libps/220A1_all/amt/amt.a b/ap/lib/libps/220A1_all/amt/amt.a
index 6001a97..65ea8df 100755
--- a/ap/lib/libps/220A1_all/amt/amt.a
+++ b/ap/lib/libps/220A1_all/amt/amt.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/appstart/appstart.a b/ap/lib/libps/220A1_all/appstart/appstart.a
index 3f84b06..d35d459 100755
--- a/ap/lib/libps/220A1_all/appstart/appstart.a
+++ b/ap/lib/libps/220A1_all/appstart/appstart.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/amr.a b/ap/lib/libps/220A1_all/drv/amr.a
index 0d2d828..be6e320 100755
--- a/ap/lib/libps/220A1_all/drv/amr.a
+++ b/ap/lib/libps/220A1_all/drv/amr.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/audio_base.a b/ap/lib/libps/220A1_all/drv/audio_base.a
index dea0488..f0e5cf5 100755
--- a/ap/lib/libps/220A1_all/drv/audio_base.a
+++ b/ap/lib/libps/220A1_all/drv/audio_base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/chip.a b/ap/lib/libps/220A1_all/drv/chip.a
index d0b19d7..9287206 100755
--- a/ap/lib/libps/220A1_all/drv/chip.a
+++ b/ap/lib/libps/220A1_all/drv/chip.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/drv_sdk.a b/ap/lib/libps/220A1_all/drv/drv_sdk.a
index 5688b21..1b5f717 100755
--- a/ap/lib/libps/220A1_all/drv/drv_sdk.a
+++ b/ap/lib/libps/220A1_all/drv/drv_sdk.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/public.a b/ap/lib/libps/220A1_all/drv/public.a
index 343c591..297e54b 100755
--- a/ap/lib/libps/220A1_all/drv/public.a
+++ b/ap/lib/libps/220A1_all/drv/public.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/webrtc.a b/ap/lib/libps/220A1_all/drv/webrtc.a
index 1a025a0..8034509 100755
--- a/ap/lib/libps/220A1_all/drv/webrtc.a
+++ b/ap/lib/libps/220A1_all/drv/webrtc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/gsml1/dwddrv.a b/ap/lib/libps/220A1_all/gsml1/dwddrv.a
index fae0c70..c6f86d7 100755
--- a/ap/lib/libps/220A1_all/gsml1/dwddrv.a
+++ b/ap/lib/libps/220A1_all/gsml1/dwddrv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/gsml1/l1g.a b/ap/lib/libps/220A1_all/gsml1/l1g.a
index 0893917..f7bb59b 100755
--- a/ap/lib/libps/220A1_all/gsml1/l1g.a
+++ b/ap/lib/libps/220A1_all/gsml1/l1g.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/phy/phy.a b/ap/lib/libps/220A1_all/phy/phy.a
index 9f66d24..ac56d9f 100755
--- a/ap/lib/libps/220A1_all/phy/phy.a
+++ b/ap/lib/libps/220A1_all/phy/phy.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a
index 645d897..c7c8e92 100755
--- a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a
index 52eb9f6..28c472c 100755
--- a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a
+++ b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a
index 049a5f6..091090f 100755
--- a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a
+++ b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/plat_osa_linux.a b/ap/lib/libps/220A1_all/plat/plat_osa_linux.a
index 645d897..c7c8e92 100755
--- a/ap/lib/libps/220A1_all/plat/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_all/plat/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/plat_psm.a b/ap/lib/libps/220A1_all/plat/plat_psm.a
index 52eb9f6..28c472c 100755
--- a/ap/lib/libps/220A1_all/plat/plat_psm.a
+++ b/ap/lib/libps/220A1_all/plat/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/plat_sup.a b/ap/lib/libps/220A1_all/plat/plat_sup.a
index 049a5f6..091090f 100755
--- a/ap/lib/libps/220A1_all/plat/plat_sup.a
+++ b/ap/lib/libps/220A1_all/plat/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/as_com.a b/ap/lib/libps/220A1_all/ps/as_com.a
index 850dbeb..960e5be 100755
--- a/ap/lib/libps/220A1_all/ps/as_com.a
+++ b/ap/lib/libps/220A1_all/ps/as_com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/as_gsm.a b/ap/lib/libps/220A1_all/ps/as_gsm.a
index 0537f0b..878a43e 100755
--- a/ap/lib/libps/220A1_all/ps/as_gsm.a
+++ b/ap/lib/libps/220A1_all/ps/as_gsm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/ati.a b/ap/lib/libps/220A1_all/ps/ati.a
index 1d28e9a..213c557 100755
--- a/ap/lib/libps/220A1_all/ps/ati.a
+++ b/ap/lib/libps/220A1_all/ps/ati.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/com.a b/ap/lib/libps/220A1_all/ps/com.a
index fb0f0d7..433ba68 100755
--- a/ap/lib/libps/220A1_all/ps/com.a
+++ b/ap/lib/libps/220A1_all/ps/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/el2_up.a b/ap/lib/libps/220A1_all/ps/el2_up.a
index cc91924..a916285 100755
--- a/ap/lib/libps/220A1_all/ps/el2_up.a
+++ b/ap/lib/libps/220A1_all/ps/el2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/eudbg.a b/ap/lib/libps/220A1_all/ps/eudbg.a
index f8735ca..8e0b34d 100755
--- a/ap/lib/libps/220A1_all/ps/eudbg.a
+++ b/ap/lib/libps/220A1_all/ps/eudbg.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/eurrc.a b/ap/lib/libps/220A1_all/ps/eurrc.a
index 1ec384e..baecb85 100755
--- a/ap/lib/libps/220A1_all/ps/eurrc.a
+++ b/ap/lib/libps/220A1_all/ps/eurrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/l1e.a b/ap/lib/libps/220A1_all/ps/l1e.a
index 6e0e3d5..3793c6c 100755
--- a/ap/lib/libps/220A1_all/ps/l1e.a
+++ b/ap/lib/libps/220A1_all/ps/l1e.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/nas.a b/ap/lib/libps/220A1_all/ps/nas.a
index 76551f1..5cbb2d3 100755
--- a/ap/lib/libps/220A1_all/ps/nas.a
+++ b/ap/lib/libps/220A1_all/ps/nas.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/ul1t.a b/ap/lib/libps/220A1_all/ps/ul1t.a
index 5d1e68e..5a42e34 100755
--- a/ap/lib/libps/220A1_all/ps/ul1t.a
+++ b/ap/lib/libps/220A1_all/ps/ul1t.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/ul2_up.a b/ap/lib/libps/220A1_all/ps/ul2_up.a
index 48d8892..43a16d8 100755
--- a/ap/lib/libps/220A1_all/ps/ul2_up.a
+++ b/ap/lib/libps/220A1_all/ps/ul2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/urrc.a b/ap/lib/libps/220A1_all/ps/urrc.a
index 90a6ca3..e3eabfd 100755
--- a/ap/lib/libps/220A1_all/ps/urrc.a
+++ b/ap/lib/libps/220A1_all/ps/urrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/wl1w.a b/ap/lib/libps/220A1_all/ps/wl1w.a
index a974639..c9d19f1 100755
--- a/ap/lib/libps/220A1_all/ps/wl1w.a
+++ b/ap/lib/libps/220A1_all/ps/wl1w.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/wl2_up.a b/ap/lib/libps/220A1_all/ps/wl2_up.a
index 8ccc116..0c21303 100755
--- a/ap/lib/libps/220A1_all/ps/wl2_up.a
+++ b/ap/lib/libps/220A1_all/ps/wl2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/psbase/base.a b/ap/lib/libps/220A1_all/psbase/base.a
index b0ef134..924ca51 100755
--- a/ap/lib/libps/220A1_all/psbase/base.a
+++ b/ap/lib/libps/220A1_all/psbase/base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ref/com.a b/ap/lib/libps/220A1_all/ref/com.a
index f2cf85d..923c783 100755
--- a/ap/lib/libps/220A1_all/ref/com.a
+++ b/ap/lib/libps/220A1_all/ref/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ref/ref_drv.a b/ap/lib/libps/220A1_all/ref/ref_drv.a
index 6b08206..488ca0e 100755
--- a/ap/lib/libps/220A1_all/ref/ref_drv.a
+++ b/ap/lib/libps/220A1_all/ref/ref_drv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/tools/tools.a b/ap/lib/libps/220A1_all/tools/tools.a
index 7011acf..d4723e4 100755
--- a/ap/lib/libps/220A1_all/tools/tools.a
+++ b/ap/lib/libps/220A1_all/tools/tools.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/usat/usat.a b/ap/lib/libps/220A1_all/usat/usat.a
index e74333e..d0835e9 100755
--- a/ap/lib/libps/220A1_all/usat/usat.a
+++ b/ap/lib/libps/220A1_all/usat/usat.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/amt/amt.a b/ap/lib/libps/220A1_vehicle_dc/amt/amt.a
index 4076b2a..356b54f 100755
--- a/ap/lib/libps/220A1_vehicle_dc/amt/amt.a
+++ b/ap/lib/libps/220A1_vehicle_dc/amt/amt.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a b/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a
index 495f8e1..6bfadee 100755
--- a/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a
+++ b/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/amr.a b/ap/lib/libps/220A1_vehicle_dc/drv/amr.a
index 3f58298..e1f4f7d 100755
--- a/ap/lib/libps/220A1_vehicle_dc/drv/amr.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/amr.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a b/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a
index 2b2ba7a..5b7727c 100755
--- a/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/chip.a b/ap/lib/libps/220A1_vehicle_dc/drv/chip.a
index d3a2239..9bcfd0b 100755
--- a/ap/lib/libps/220A1_vehicle_dc/drv/chip.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/chip.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a b/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a
index 67301a6..de99f86 100755
--- a/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/public.a b/ap/lib/libps/220A1_vehicle_dc/drv/public.a
index 617d43c..4ee66c7 100755
--- a/ap/lib/libps/220A1_vehicle_dc/drv/public.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/public.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a b/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a
index e7b90ba..2a1ec6e 100755
--- a/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a b/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a
index f62ea38..cf507ae 100755
--- a/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a
+++ b/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a b/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a
index f083d33..f88e23d 100755
--- a/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a
+++ b/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_crypto.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_crypto.a
index c6d019c..7de5cbb 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_crypto.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_crypto.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_mbedtls.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_mbedtls.a
index b32f8a9..37e0e46 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_mbedtls.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_mbedtls.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_ta.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_ta.a
index 64a4d20..c5a2239 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_ta.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_ta.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_tee.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_tee.a
index e7ca035..c97b3b1 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_tee.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_tee.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_tomcrypt.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_tomcrypt.a
index 9e239cb..74bc070 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_tomcrypt.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_tomcrypt.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_utee.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_utee.a
index 87951a9..24aa11d 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_utee.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_utee.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/optee/optee_utils.a b/ap/lib/libps/220A1_vehicle_dc/optee/optee_utils.a
index d053858..35bd5ad 100755
--- a/ap/lib/libps/220A1_vehicle_dc/optee/optee_utils.a
+++ b/ap/lib/libps/220A1_vehicle_dc/optee/optee_utils.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/phy/phy.a b/ap/lib/libps/220A1_vehicle_dc/phy/phy.a
index c15030f..aa8ee37 100755
--- a/ap/lib/libps/220A1_vehicle_dc/phy/phy.a
+++ b/ap/lib/libps/220A1_vehicle_dc/phy/phy.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a
index 7ee0df8..73bb587 100755
--- a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a
index 0e8aa70..3e76dad 100755
--- a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a
index fed5d4c..f3a631f 100755
--- a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a b/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a
index 7ee0df8..73bb587 100755
--- a/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a b/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a
index 0e8aa70..3e76dad 100755
--- a/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a b/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a
index fed5d4c..f3a631f 100755
--- a/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a b/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a
index 9fc7f45..b3a700c 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a b/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a
index 374c2e2..1c12699 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/ati.a b/ap/lib/libps/220A1_vehicle_dc/ps/ati.a
index 729699b..a8da68e 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/ati.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/ati.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/com.a b/ap/lib/libps/220A1_vehicle_dc/ps/com.a
index 47cc839..8fe2747 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/com.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a b/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a
index 3106c2d..03228d3 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a b/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a
index 2d3211d..217e24c 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a b/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a
index 1531ef7..d2e5e86 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a b/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a
index ffcd853..ee156be 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/nas.a b/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
index 490b58f..845b97c 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a b/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a
index 43dd473..86b3182 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a b/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a
index 1f81b69..a7e53d2 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a b/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a
index 829aa88..84a83f4 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a b/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a
index c744823..0160f49 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a b/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a
index fc009d7..6f93ee2 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/psbase/base.a b/ap/lib/libps/220A1_vehicle_dc/psbase/base.a
index 13b12c9..4055510 100755
--- a/ap/lib/libps/220A1_vehicle_dc/psbase/base.a
+++ b/ap/lib/libps/220A1_vehicle_dc/psbase/base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ref/com.a b/ap/lib/libps/220A1_vehicle_dc/ref/com.a
index 35ece11..3209335 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ref/com.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ref/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a b/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a
index 453e9b0..3b55b05 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/tools/tools.a b/ap/lib/libps/220A1_vehicle_dc/tools/tools.a
index 3e11fdc..2d1bf89 100755
--- a/ap/lib/libps/220A1_vehicle_dc/tools/tools.a
+++ b/ap/lib/libps/220A1_vehicle_dc/tools/tools.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/usat/usat.a b/ap/lib/libps/220A1_vehicle_dc/usat/usat.a
index 8cd3670..b7e083e 100755
--- a/ap/lib/libps/220A1_vehicle_dc/usat/usat.a
+++ b/ap/lib/libps/220A1_vehicle_dc/usat/usat.a
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer.a b/ap/lib/libsoft_timer/libsoft_timer.a
index 115dfa1..d1d5604 100755
--- a/ap/lib/libsoft_timer/libsoft_timer.a
+++ b/ap/lib/libsoft_timer/libsoft_timer.a
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer.so b/ap/lib/libsoft_timer/libsoft_timer.so
index 2b8916c..0ce775e 100755
--- a/ap/lib/libsoft_timer/libsoft_timer.so
+++ b/ap/lib/libsoft_timer/libsoft_timer.so
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer_sc.a b/ap/lib/libsoft_timer/libsoft_timer_sc.a
index 3100342..6836797 100755
--- a/ap/lib/libsoft_timer/libsoft_timer_sc.a
+++ b/ap/lib/libsoft_timer/libsoft_timer_sc.a
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer_sc.so b/ap/lib/libsoft_timer/libsoft_timer_sc.so
index d08548a..29d6894 100755
--- a/ap/lib/libsoft_timer/libsoft_timer_sc.so
+++ b/ap/lib/libsoft_timer/libsoft_timer_sc.so
Binary files differ
diff --git a/ap/lib/libsoftap/netotherapi.c b/ap/lib/libsoftap/netotherapi.c
index 62edaaf..4fb37f5 100755
--- a/ap/lib/libsoftap/netotherapi.c
+++ b/ap/lib/libsoftap/netotherapi.c
@@ -1242,6 +1242,7 @@
 #define DNS_SERVER_NUM 2
 
 #define T_A 1 //Ipv4 address
+#define T_AAAA 28 //Ipv6 address
 #define T_NS 2 //Nameserver
 #define T_CNAME 5 // canonical name
 #define T_SOA 6 /* start of authority zone */
@@ -1374,7 +1375,7 @@
 	
 	struct sockaddr_in a;
 
-	struct RES_RECORD answers[20], auth[20], addit[20]; //the replies from the DNS server
+	struct RES_RECORD answers[20]; //the replies from the DNS server
 	struct sockaddr_in dest;
 
 	struct DNS_HEADER *dns = NULL;
@@ -1434,7 +1435,7 @@
 	qinfo->qtype = htons(query_type); //type of the query , A , MX , CNAME , NS etc
 	qinfo->qclass = htons(1); //its internet (lol)
 
-	printf("\nSending Packet...");
+	printf("\nSending Packet to %s...", dns_server);
 	if (sendto(s, (char*) buf,
 			sizeof(struct DNS_HEADER) + (strlen((const char*) qname) + 1)
 					+ sizeof(struct QUESTION), 0, (struct sockaddr*) &dest,
@@ -1487,7 +1488,7 @@
 		answers[i].resource = (struct R_DATA*) (reader);
 		reader = reader + sizeof(struct R_DATA);
 
-		if (ntohs(answers[i].resource->type) == 1) //if its an ipv4 address
+		if (ntohs(answers[i].resource->type) == T_A) //if its an ipv4 address
 				{
 			answers[i].rdata = (unsigned char*) malloc(
 					ntohs(answers[i].resource->data_len));
@@ -1528,15 +1529,15 @@
 			//Canonical name for an alias
 			printf("has alias name : %s", answers[i].rdata);
 		}
-
 		printf("\n");
+		free(answers[i].name);
+		free(answers[i].rdata);
 	}
 out:
 	close(s);
 	return ret;
 }
 
-
 unsigned long gethostbyname_l(char *hostname,char* dev_name) 
 {
 	int i = 0;
@@ -1547,13 +1548,13 @@
 	char nv_dns[32]	= {0};
 	char ip_dns[32]	= {0};
 	
-    sprintf(nv_dns, "%s_pridns", dev_name);
+    snprintf(nv_dns, sizeof(nv_dns), "%s_pridns", dev_name);
 	sc_cfg_get(nv_dns, ip_dns, sizeof(ip_dns));
 	strcpy(dns_servers[0], ip_dns);
 
 	memset(nv_dns,0,sizeof(nv_dns));
 	memset(ip_dns,0,sizeof(ip_dns));
-	sprintf(nv_dns, "%s_secdns", dev_name);
+	snprintf(nv_dns, sizeof(nv_dns), "%s_secdns", dev_name);
 	sc_cfg_get(nv_dns, ip_dns, sizeof(ip_dns));
 	strcpy(dns_servers[1], ip_dns);
 
@@ -1569,7 +1570,217 @@
 	return ret;
 }
 
+int my_gethostbyname6(unsigned char *host, char *dev_name, char* dns_server, int query_type, struct in6_addr* ip6)
+{
+	unsigned char buf[1025], *qname, *reader;
+	int i, j, stop, s, ans_max, ret = 0;
+	struct timeval tv;
+	struct ifreq ifr = {0};
+	struct RES_RECORD answers[20]; //the replies from the DNS server
+	struct sockaddr_in6 dest = {0};
+	struct in6_addr a = {0};
+	struct DNS_HEADER *dns = NULL;
+	struct QUESTION *qinfo = NULL;
+	char nv_cmd[64] = {0};
+	char ip_src[64] = {0};
+	struct sockaddr_in6 src = {0};
 
+	printf("Resolving %s", host);
+
+	s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); //UDP packet for DNS queries
+	if(s < 0)
+    {
+        printf("socket return fail \n");
+        return ret;
+    }   
+	
+	memset(&ifr,0,sizeof(ifr));    
+	strncpy(ifr.ifr_name, dev_name, sizeof(ifr.ifr_name)-1);
+	if(setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, (char*)&ifr, sizeof(ifr)) < 0){
+		printf("SO_BINDTODEVICE fail \n");
+		goto out;
+	}
+	tv.tv_sec = 5;
+	tv.tv_usec = 0;
+	if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
+		printf("socket option  SO_RCVTIMEO not support\n");
+		goto out;
+	}
+	snprintf(nv_cmd, sizeof(nv_cmd), "%s_ipv6_ip", dev_name);
+	sc_cfg_get(nv_cmd, ip_src, sizeof(ip_src));
+	src.sin6_family = AF_INET6;
+	if(inet_pton(AF_INET6, ip_src, &src.sin6_addr) <= 0){
+		printf("inet_pton fail1 \n");
+		goto out;
+	}
+	if (bind(s, (struct sockaddr*)&src, sizeof(src)) < 0) {
+		printf("bind fail \n");
+		goto out;
+	}
+	dest.sin6_family = AF_INET6;
+	dest.sin6_port = htons(53);
+	if(inet_pton(AF_INET6, dns_server, &dest.sin6_addr) <= 0){
+		printf("inet_pton fail2 \n");
+		goto out;
+	}
+	//Set the DNS structure to standard queries
+	dns = (struct DNS_HEADER *) &buf;
+
+	dns->id = (unsigned short) htons(getpid());
+	dns->qr = 0; //This is a query
+	dns->opcode = 0; //This is a standard query
+	dns->aa = 0; //Not Authoritative
+	dns->tc = 0; //This message is not truncated
+	dns->rd = 1; //Recursion Desired
+	dns->ra = 0; //Recursion not available! hey we dont have it (lol)
+	dns->z = 0;
+	dns->ad = 0;
+	dns->cd = 0;
+	dns->rcode = 0;
+	dns->q_count = htons(1); //we have only 1 question
+	dns->ans_count = 0;
+	dns->auth_count = 0;
+	dns->add_count = 0;
+
+	//point to the query portion
+	qname = (unsigned char*) &buf[sizeof(struct DNS_HEADER)];
+
+	ChangetoDnsNameFormat(qname, host);
+	qinfo = (struct QUESTION*) &buf[sizeof(struct DNS_HEADER)
+			+ (strlen((const char*) qname) + 1)]; //fill it
+
+	qinfo->qtype = htons(query_type); //type of the query , A , MX , CNAME , NS etc
+	qinfo->qclass = htons(1); //its internet (lol)
+
+	printf("\nSending Packet to %s...", dns_server);
+	if (sendto(s, (char*) buf,
+			sizeof(struct DNS_HEADER) + (strlen((const char*) qname) + 1)
+					+ sizeof(struct QUESTION), 0, (struct sockaddr*) &dest,
+			sizeof(dest)) < 0) {
+		perror("sendto failed");
+	}
+	printf("Done");
+
+	//Receive the answer
+	i = sizeof dest;
+	printf("\nReceiving answer...");
+	if (recvfrom(s, (char*) buf, sizeof(buf)-1, 0, (struct sockaddr*) &dest,
+			(socklen_t*) &i) < 0) {
+		perror("recvfrom failed");
+	}
+	*(buf+sizeof(buf)-1) = 0;
+	printf("Done");
+
+	dns = (struct DNS_HEADER*) buf;
+	if((sizeof(struct DNS_HEADER) + 
+		(strlen((const char*) qname) + 1)+ 
+		sizeof(struct QUESTION)) >= sizeof(buf))
+	{
+		perror("my_gethostbyname error");
+		goto out;
+	}
+	
+	//move ahead of the dns header and the query field
+	reader = &buf[sizeof(struct DNS_HEADER) + (strlen((const char*) qname) + 1)
+			+ sizeof(struct QUESTION)];
+
+	//printf("\nThe response contains : ");
+	//printf("\n %d Questions.", ntohs(dns->q_count));
+	//printf("\n %d Answers.", ntohs(dns->ans_count));
+	//printf("\n %d Authoritative Servers.", ntohs(dns->auth_count));
+	//printf("\n %d Additional records.\n\n", ntohs(dns->add_count));
+
+	//Start reading answers
+	stop = 0;
+	ans_max = ntohs(dns->ans_count);
+	if (ans_max > (sizeof(answers)/sizeof(answers[0])))
+		ans_max = (sizeof(answers)/sizeof(answers[0]));
+	for (i = 0; i < ans_max; i++) 
+	{
+		answers[i].name = ReadName(reader, buf, &stop);
+		reader = reader + stop;
+
+		answers[i].resource = (struct R_DATA*) (reader);
+		reader = reader + sizeof(struct R_DATA);
+
+		if (ntohs(answers[i].resource->type) == T_AAAA) //if its an ipv6 address
+				{
+			answers[i].rdata = (unsigned char*) malloc(
+					ntohs(answers[i].resource->data_len));
+
+			for (j = 0; j < ntohs(answers[i].resource->data_len); j++) {
+				answers[i].rdata[j] = reader[j];
+			}
+
+			answers[i].rdata[ntohs(answers[i].resource->data_len)] = '\0';
+
+			reader = reader + ntohs(answers[i].resource->data_len);
+		} else {
+			answers[i].rdata = ReadName(reader, buf, &stop);
+			reader = reader + stop;
+		}
+	}
+
+	//print answers
+	printf("\nAnswer Records : %d \n", ntohs(dns->ans_count));
+	for (i = 0; i < ans_max; i++) {
+		printf("Name : %s ", answers[i].name);
+
+		if (ntohs(answers[i].resource->type) == T_AAAA) //IPv6 address
+		{
+			char ip6_addr[IPV6ADDLEN_MAX] = {0};
+			memcpy(&a, answers[i].rdata, sizeof(struct in6_addr));
+			if(inet_ntop(AF_INET6, &a, ip6_addr, sizeof(ip6_addr))){
+				if(ip6)
+					memcpy(ip6, &a, sizeof(struct in6_addr));
+				printf("%p has IPv6 address : %s", ip6, ip6_addr);
+				ret = 1;
+			}else
+				printf("nohas IPv6 address len:%d", answers[i].resource->data_len);
+		}
+
+		if (ntohs(answers[i].resource->type) == 5) {
+			//Canonical name for an alias
+			printf("has alias name : %s", answers[i].rdata);
+		}
+		printf("\n");
+		free(answers[i].name);
+		free(answers[i].rdata);
+	}
+out:
+	close(s);
+	return ret;
+}
+
+int gethostbyname6_l(char *hostname,char* dev_name, struct in6_addr* ip6) 
+{
+	int i = 0;
+	unsigned long ret = 0;
+	char dns_servers[DNS_SERVER_NUM][64] = {0};
+
+	//Get the DNS servers from the resolv.conf file
+	char nv_dns[64]	= {0};
+	char ip_dns[64]	= {0};
+	
+    sprintf(nv_dns, "%s_ipv6_pridns_auto", dev_name);
+	sc_cfg_get(nv_dns, ip_dns, sizeof(ip_dns));
+	strcpy(dns_servers[0], ip_dns);
+
+	memset(nv_dns,0,sizeof(nv_dns));
+	memset(ip_dns,0,sizeof(ip_dns));
+	sprintf(nv_dns, "%s_ipv6_secdns_auto", dev_name);
+	sc_cfg_get(nv_dns, ip_dns, sizeof(ip_dns));
+	strcpy(dns_servers[1], ip_dns);
+
+	
+	//Now get the ip of this hostname , A record
+	for(i=0;i<DNS_SERVER_NUM;i++)
+	{
+		if(my_gethostbyname6(hostname, dev_name , dns_servers[i], T_AAAA, ip6))
+			return 0;
+	}
+	return -1;
+}
 
 
 /******************************************************************************/
diff --git a/ap/lib/libupi_ab/libupi_ab.a b/ap/lib/libupi_ab/libupi_ab.a
index 21e154a..bbe62f7 100755
--- a/ap/lib/libupi_ab/libupi_ab.a
+++ b/ap/lib/libupi_ab/libupi_ab.a
Binary files differ
diff --git a/ap/lib/libupi_ab/libupi_ab.so b/ap/lib/libupi_ab/libupi_ab.so
index 9355831..ec0ad86 100755
--- a/ap/lib/libupi_ab/libupi_ab.so
+++ b/ap/lib/libupi_ab/libupi_ab.so
Binary files differ
diff --git a/ap/lib/libvoice/alsa_call.c b/ap/lib/libvoice/alsa_call.c
index 72f82ce..37a4820 100755
--- a/ap/lib/libvoice/alsa_call.c
+++ b/ap/lib/libvoice/alsa_call.c
@@ -123,8 +123,10 @@
 	

 	}

     /* open mixer dev for codec control */

-    if(!(voice_mixer = mixer_open(0))) 

+    if(!(voice_mixer = mixer_open(0))) {

        printf("mixer open fail, file(%s), line(%d)\n", __FILE__, __LINE__);

+       return -2;

+    }

 

 

 	if(T_OUTPUT_SPEAKER == current_chanl) {

@@ -155,6 +157,7 @@
 	else

 	{

 		printf("alsa_voice_open: chanl not support fail!\n");

+        mixer_close(voice_mixer);

 		return -2;

 

 	}

diff --git a/ap/lib/libzcore/min/libbitmap_font.a b/ap/lib/libzcore/min/libbitmap_font.a
index 7e6c60c..88b2fd0 100755
--- a/ap/lib/libzcore/min/libbitmap_font.a
+++ b/ap/lib/libzcore/min/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/min/libttf_font.a b/ap/lib/libzcore/min/libttf_font.a
index 72a0935..d74ebd6 100755
--- a/ap/lib/libzcore/min/libttf_font.a
+++ b/ap/lib/libzcore/min/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/min/libzcore.a b/ap/lib/libzcore/min/libzcore.a
index cd99553..7d9f8ec 100755
--- a/ap/lib/libzcore/min/libzcore.a
+++ b/ap/lib/libzcore/min/libzcore.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a b/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a
index d50731b..282d046 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a b/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a
index 7708efd..48bae68 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a b/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a
index 6e32965..a585b7f 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a
index 653317a..dc5a6d2 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a
index 3f4d41d..b7bbf84 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/framework.a b/ap/lib/libzcore/std/lib/lib/fwp/framework.a
index 6b9ac01..83f986e 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a b/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a
index 2b7df27..68167da 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/gui.a b/ap/lib/libzcore/std/lib/lib/fwp/gui.a
index 536874a..a4a9113 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/msm.a b/ap/lib/libzcore/std/lib/lib/fwp/msm.a
index 9c0c797..a99d966 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a b/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a
index 6b6a864..29e92c1 100755
--- a/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a
index 5a73912..b060eea 100755
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a
index 8d58927..3d931b8 100755
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a
index 56d2bc2..c39dfba 100755
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a
index 4b3afaf..174a3ca 100755
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a
index 83b2222..d4a8b6e 100755
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a b/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a
index 4343eb2..802e655 100755
--- a/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_phone.a b/ap/lib/libzcore/std/lib/lib/libzcore_phone.a
index 78b1127..e9e6b7e 100755
--- a/ap/lib/libzcore/std/lib/lib/libzcore_phone.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_phone.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_poc.a b/ap/lib/libzcore/std/lib/lib/libzcore_poc.a
index 7a83790..8b53ddf 100755
--- a/ap/lib/libzcore/std/lib/lib/libzcore_poc.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_poc.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_watch.a b/ap/lib/libzcore/std/lib/lib/libzcore_watch.a
index 083af0d..73488ba 100755
--- a/ap/lib/libzcore/std/lib/lib/libzcore_watch.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_watch.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/app_fw.a b/ap/lib/libzcore/std/lib/lib/phone/app_fw.a
index aaf0d8a..b8ea9c5 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a b/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a
index 45d78d4..5dad6a8 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a b/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a
index 299883c..0f9eb02 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a
index 1c9243d..a4e04d9 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a
index e8fba7b..88badc3 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/framework.a b/ap/lib/libzcore/std/lib/lib/phone/framework.a
index 97fa214..f7f5e35 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a b/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a
index 7952463..2cedb8a 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/gui.a b/ap/lib/libzcore/std/lib/lib/phone/gui.a
index cd3d7a2..2e7d209 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/msm.a b/ap/lib/libzcore/std/lib/lib/phone/msm.a
index 3be093e..1a14c5e 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a b/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a
index f251d36..2c0ec30 100755
--- a/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/app_fw.a b/ap/lib/libzcore/std/lib/lib/poc/app_fw.a
index 00a2e2f..e8fc069 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a b/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a
index 7279855..deee181 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a b/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a
index e11516c..48898d9 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a
index b153e45..2beb3ef 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a
index 48ed051..d244f5a 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/framework.a b/ap/lib/libzcore/std/lib/lib/poc/framework.a
index ad89b6f..ea6c4f9 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a b/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a
index 7ba95ce..64dcfc8 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/gui.a b/ap/lib/libzcore/std/lib/lib/poc/gui.a
index 2f4d78e..a67c529 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/msm.a b/ap/lib/libzcore/std/lib/lib/poc/msm.a
index cb8b615..ac866f7 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a b/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a
index c70acba..23bb1a3 100755
--- a/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/app_fw.a b/ap/lib/libzcore/std/lib/lib/watch/app_fw.a
index f2b9e29..96e0e3c 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a b/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a
index 1bff370..bbf5612 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a b/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a
index 6f19f96..c0fea40 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a
index 42d0c16..fa94ac9 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a
index 4c6248e..ffc0ae4 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/framework.a b/ap/lib/libzcore/std/lib/lib/watch/framework.a
index 517307e..b5951a6 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a b/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a
index 3a9063c..2f07441 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/gui.a b/ap/lib/libzcore/std/lib/lib/watch/gui.a
index b7ea0d9..e684fa6 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/msm.a b/ap/lib/libzcore/std/lib/lib/watch/msm.a
index 4b9b507..389f37d 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a b/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a
index 20733f0..ce9f2d5 100755
--- a/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzte_vsim/libzte_vsim.a b/ap/lib/libzte_vsim/libzte_vsim.a
index 23cfb63..4838644 100755
--- a/ap/lib/libzte_vsim/libzte_vsim.a
+++ b/ap/lib/libzte_vsim/libzte_vsim.a
Binary files differ