Download Client Library not connecting again after few attempt(s)

Hi,

I am using the download client library (MFW 1.1.4 due to Verizon compatibility) and am noticing that the TLS handshake with my server only succeeds after the first few attempts after a system reboot. I modified the HTTPS Download Client sample by tying the function to a button interrupt. I get the error "<err> download_client: Unable to connect, errno 22".

I ran openssl for debugging like so on my server:

openssl  s_server -accept 443 -key server.key -cert server.crt -CAfile ca.crt -verify_return_error -Verify 2 -state

And got this output when my device connected to my server (failed attempt):

ACCEPT
SSL_accept:before SSL initialization
SSL_accept:before SSL initialization
SSL_accept:SSLv3/TLS read client hello
SSL_accept:SSLv3/TLS write server hello
SSL_accept:SSLv3/TLS write certificate
SSL_accept:SSLv3/TLS write key exchange
SSL_accept:SSLv3/TLS write certificate request
SSL_accept:SSLv3/TLS write server done
SSL_accept:SSLv3/TLS write server done
depth=1 CN = TestCA
verify return:1
depth=0 CN = TestClient_1
verify return:1
SSL_accept:SSLv3/TLS read client certificate
SSL_accept:error in SSLv3/TLS read client key exchange
ERROR
shutting down SSL
CONNECTION CLOSED

When it is successful, I get a response similar to that shown in https://www.golinuxcloud.com/mutual-tls-authentication-mtls/ 

Seems the client key exchanging is failing, causing the TLS handshake to fail. Any ideas why? Must I reset any of the data structurers in the download_client library?

Otherwise, this may be suggestive of a bug.

Thanks

Related