Hello,
I looking for some help with creating https client. I saw many examples, all like this: mbedtls/ssl_client1.c at development · Mbed-TLS/mbedtls · GitHub
Porting Mbed TLS to a new environment or OS — Mbed TLS documentation etc.
( I based on this example but still have some problem with it)
I’m using k64f board, LwIP and mbedtls.
I have some connection with my server. I sent from my client the “Client Hello” message. Then my server answered “Server hello”, with certificate etc.
Unfortunately my client isn’t receiving this data and handshaking stops.
To make connections I use tcp_pcb *pcb, and tcp_connect function:
tcp_connect(pcb, &dest, HTTPS_PORT, client_connected);
I initialize of course (I think) all mbed ssl functions (among others):
mbedtls_ssl_init(&ssl);
mbedtls_ssl_config_init(&conf);
After making connection i setting the callbacks:
mbedtls_ssl_set_bio(&ssl, pcb, my_mbedtls_net_send, my_mbedtls_net_recv, NULL);
With my “my_mbedtls_net_recv” and “my_mbedtls_net_send” functions.
Now my questions:
-
Why my my_mbedtls_net_recv isn’t receiving data?
( if I add my extra callback function like this:
tcp_recv(hs->pcb, http_recv);
where:
static err_t http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
tcp_recved(hs->pcb, hs->req->tot_len);
printf(“p->tot_len = %d”,p->tot_len);
return ERR_OK;
}
“Server Hello” message is receiving by this function, but too late and not while handshaking (handshaking is already stopped)
) -
How to direct data from liwp to the my_mbedtls_net_recv function?
I know it is little complicated,
Could You help me with it?