BugID:21666905:[hal]modify hal tls
@@ -515,9 +515,9 @@ static int _TLSConnectNetwork(TLSDataParams_t *pTlsData, const char *addr,
if (NULL == saved_session) {
do {
int len = TLS_MAX_SESSION_BUF;
- char device_key[PRODUCT_KEY_MAXLEN + DEVICE_NAME_MAXLEN + 6] = {0};
- char _product_key[PRODUCT_KEY_LEN + 1] = {0};
- char _device_name[DEVICE_NAME_LEN + 1] = {0};
+ char device_key[IOTX_PRODUCT_KEY_LEN + IOTX_DEVICE_NAME_LEN + 6] = {0};
+ char _product_key[IOTX_PRODUCT_KEY_LEN + 1] = {0};
+ char _device_name[IOTX_DEVICE_NAME_LEN + 1] = {0};
unsigned char *save_buf = aos_malloc(TLS_MAX_SESSION_BUF);
if (save_buf == NULL) {
platform_err(" malloc failed");
@@ -539,7 +539,7 @@ static int _TLSConnectNetwork(TLSDataParams_t *pTlsData, const char *addr,
HAL_GetProductKey(_product_key);
HAL_GetDeviceName(_device_name);
- HAL_Snprintf(device_key, PRODUCT_KEY_MAXLEN + DEVICE_NAME_MAXLEN + 5, KV_SESSION_KEY, _product_key, _device_name);
+ HAL_Snprintf(device_key, IOTX_PRODUCT_KEY_LEN + IOTX_DEVICE_NAME_LEN + 5, KV_SESSION_KEY, _product_key, _device_name);
ret = HAL_Kv_Get(device_key, save_buf, &len);
if (ret != 0 || len == 0) {
@@ -615,13 +615,13 @@ static int _TLSConnectNetwork(TLSDataParams_t *pTlsData, const char *addr,
ret = ssl_serialize_session(saved_session, save_buf, TLS_MAX_SESSION_BUF, &real_session_len);
platform_info("mbedtls_ssl_get_session_session return 0x%04x real_len=%d\r\n", ret, real_session_len);
if (ret == 0) {
- char device_key[PRODUCT_KEY_MAXLEN + DEVICE_NAME_MAXLEN + 6] = {0};
- char _product_key[PRODUCT_KEY_LEN + 1] = {0};
- char _device_name[DEVICE_NAME_LEN + 1] = {0};
+ char device_key[IOTX_PRODUCT_KEY_LEN + IOTX_DEVICE_NAME_LEN + 6] = {0};
+ char _product_key[IOTX_PRODUCT_KEY_LEN + 1] = {0};
+ char _device_name[IOTX_DEVICE_NAME_LEN + 1] = {0};
HAL_GetProductKey(_product_key);
HAL_GetDeviceName(_device_name);
- HAL_Snprintf(device_key, PRODUCT_KEY_MAXLEN + DEVICE_NAME_MAXLEN + 5, KV_SESSION_KEY, _product_key, _device_name);
+ HAL_Snprintf(device_key, IOTX_PRODUCT_KEY_LEN + IOTX_DEVICE_NAME_LEN + 5, KV_SESSION_KEY, _product_key, _device_name);
HAL_Kv_Set(device_key, (void *)save_buf, real_session_len, 1);
}
aos_free(save_buf);
