@@ -51,9 +51,9 @@ static int nettype_tls_entropy_source(void *data, uint8_t *output, size_t len, s
5151static int nettype_tls_init (network_t * n , nettype_tls_params_t * nettype_tls_params )
5252{
5353 int rc = MQTT_SUCCESS_ERROR ;
54-
54+
5555 mbedtls_platform_set_calloc_free (platform_memory_calloc , platform_memory_free );
56-
56+
5757 mbedtls_net_init (& (nettype_tls_params -> socket_fd ));
5858 mbedtls_ssl_init (& (nettype_tls_params -> ssl ));
5959 mbedtls_ssl_config_init (& (nettype_tls_params -> ssl_conf ));
@@ -99,7 +99,7 @@ static int nettype_tls_init(network_t* n, nettype_tls_params_t* nettype_tls_para
9999 MQTT_LOG_E ("%s:%d %s()... mbedtls_ssl_conf_own_cert failed returned 0x%04x" , __FILE__ , __LINE__ , __FUNCTION__ , (rc < 0 )? - rc : rc );
100100 RETURN_ERROR (rc );
101101 }
102-
102+
103103 mbedtls_ssl_conf_verify (& (nettype_tls_params -> ssl_conf ), server_certificate_verify , (void * )n -> host );
104104
105105 mbedtls_ssl_conf_authmode (& (nettype_tls_params -> ssl_conf ), MBEDTLS_SSL_VERIFY_REQUIRED );
@@ -130,7 +130,7 @@ int nettype_tls_connect(network_t* n)
130130 int rc ;
131131 if (NULL == n )
132132 RETURN_ERROR (MQTT_NULL_VALUE_ERROR );
133-
133+
134134 nettype_tls_params_t * nettype_tls_params = (nettype_tls_params_t * ) platform_memory_alloc (sizeof (nettype_tls_params_t ));
135135
136136 if (NULL == nettype_tls_params )
@@ -170,12 +170,12 @@ int nettype_tls_connect(network_t* n)
170170}
171171
172172
173- void nettype_tls_disconnect (network_t * n )
173+ void nettype_tls_disconnect (network_t * n )
174174{
175175 int rc = 0 ;
176176 if (NULL == n )
177177 return ;
178-
178+
179179 nettype_tls_params_t * nettype_tls_params = (nettype_tls_params_t * ) n -> nettype_tls_params ;
180180
181181 do {
@@ -204,7 +204,7 @@ int nettype_tls_write(network_t *n, unsigned char *buf, int len, int timeout)
204204
205205 if (NULL == n )
206206 RETURN_ERROR (MQTT_NULL_VALUE_ERROR );
207-
207+
208208 nettype_tls_params_t * nettype_tls_params = (nettype_tls_params_t * ) n -> nettype_tls_params ;
209209
210210 platform_timer_cutdown (& timer , timeout );
@@ -217,7 +217,7 @@ int nettype_tls_write(network_t *n, unsigned char *buf, int len, int timeout)
217217 } else if ((rc == 0 ) || ((rc != MBEDTLS_ERR_SSL_WANT_WRITE ) && (rc != MBEDTLS_ERR_SSL_WANT_READ ) && (rc != MBEDTLS_ERR_SSL_TIMEOUT ))) {
218218 MQTT_LOG_E ("%s:%d %s()... mbedtls_ssl_write failed: 0x%04x" , __FILE__ , __LINE__ , __FUNCTION__ , (rc < 0 )? - rc : rc );
219219 break ;
220- }
220+ }
221221 } while ((!platform_timer_is_expired (& timer )) && (write_len < len ));
222222
223223 return write_len ;
@@ -231,11 +231,11 @@ int nettype_tls_read(network_t *n, unsigned char *buf, int len, int timeout)
231231
232232 if (NULL == n )
233233 RETURN_ERROR (MQTT_NULL_VALUE_ERROR );
234-
234+
235235 nettype_tls_params_t * nettype_tls_params = (nettype_tls_params_t * ) n -> nettype_tls_params ;
236236
237237 platform_timer_cutdown (& timer , timeout );
238-
238+
239239 do {
240240 rc = mbedtls_ssl_read (& (nettype_tls_params -> ssl ), (unsigned char * )(buf + read_len ), len - read_len );
241241
@@ -244,7 +244,7 @@ int nettype_tls_read(network_t *n, unsigned char *buf, int len, int timeout)
244244 } else if ((rc == 0 ) || ((rc != MBEDTLS_ERR_SSL_WANT_WRITE ) && (rc != MBEDTLS_ERR_SSL_WANT_READ ) && (rc != MBEDTLS_ERR_SSL_TIMEOUT ))) {
245245 // MQTT_LOG_E("%s:%d %s()... mbedtls_ssl_read failed: 0x%04x", __FILE__, __LINE__, __FUNCTION__, (rc < 0 )? -rc : rc);
246246 break ;
247- }
247+ }
248248 } while ((!platform_timer_is_expired (& timer )) && (read_len < len ));
249249
250250 return read_len ;
0 commit comments