[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] lwip, mqtt and mbedtls
From: |
Manu Abraham |
Subject: |
Re: [lwip-users] lwip, mqtt and mbedtls |
Date: |
Fri, 21 Aug 2020 16:44:50 +0530 |
Hi,
> Thanks for the direction.
>
>
> So, I modified the POOL_SIZE
>
>
> #define PBUF_POOL_SIZE 24 // (was originally 8)
>
> now it freezes on altcp_mbedtls_connect()
>
> (931) altcp_mbedtls_connect:
> tcp_connect to port 8883
> (1181) tcp_conn
>
>
> This is where it freezes:
>
> err_t
> tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
> tcp_connected_fn connected)
> {
> LWIP_DEBUGF(TCP_DEBUG, ("(%d) %s: Done\n", __LINE__, __FUNCTION__));
> return ret;
> }
>
> Any idea, why that would be the case ?
I did some more digging in;
If this is enabled:
#define MBEDTLS_PLATFORM_MEMORY
Then I do get this trace:
(1305) mqtt_client_connect:
mbedtls_ssl_setup failed
tcp_close: closing in State: CLOSED
An important thing that needs to be mentioned here:
I have this ssl_client.c example from ST [1] running
on the same platform and within the same environment.
That does succeed without any issues, whatsoever.
The ssl_client application does not require any
TCP window modifications, it runs off the LWIP defaults.
However, altcp appears to be a nice glue between
existing applications and TLS applications.
At a glance, altcp does similar things as with
ssl_client.c, net_sockets.c,
but something seems to be missing with altcp,
as to why it fails. Despite all the coaxing with buffers,
altcp does not want to behave. Sigh!
Any thoughts/suggestions ?
Thanks,
Manu
[1] ST's SSL/TLS client application.
https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/STM32H743I-EVAL/Applications/mbedTLS/SSL_Client/Src/ssl_client.c
https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/STM32H743I-EVAL/Applications/mbedTLS/SSL_Client/Src/net_sockets.c
For convenience sake, I will test again:
(387) SSL_Client:
(155) ssl_test: Seeding the random number generator...
(42) mbedtls_hardware_poll: Request Words: 128
(171) ssl_test: ok
(177) ssl_test: Loading the CA root certificate ...
..
tcp_recved: received 174 bytes, wnd 17489 (31).
lwip_recvfrom(0): addr=192.168.1.34 port=4433 len=174
(358) ssl_test: 150 bytes read :
HTTP/1.0 200 OK
Content-Type: text/html
<h2>mbed TLS Test Server</h2>
<p>Successful connection using: TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384</p>
lwip_select(1, 24005c6c, 00000000, 00000000, tvsec=-1 tvusec=-1)
lwip_selscan: fd=0 ready for reading