Skip to content

Commit

Permalink
net: app: Print more info for TLS MAC verification errors
Browse files Browse the repository at this point in the history
If we get MAC verification error in handshake, it could be that
everything is fine but we ran out of heap memory in mbedtls.
In this happens, suggest the user to check amount of memory
in mbedtls as it might just fix the issue.

Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar authored and Anas Nashif committed Oct 20, 2017
1 parent 28d0dff commit 9bff68f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subsys/net/lib/app/net_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,16 @@ int _net_app_ssl_mainloop(struct net_app_ctx *ctx)
ret = mbedtls_ssl_handshake(&ctx->tls.mbedtls.ssl);
if (ret != MBEDTLS_ERR_SSL_WANT_READ &&
ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
/* If we get MAC verification failure, then it usually
* means that we ran out of heap. As that Invalid MAC
* error is really confusing, give hint about possible
* out of memory issue.
*/
if (ret == MBEDTLS_ERR_SSL_INVALID_MAC) {
NET_DBG("Check CONFIG_MBEDTLS_HEAP_SIZE as "
"you could be out of mem in mbedtls");
}

if (ret < 0) {
goto close;
}
Expand Down

0 comments on commit 9bff68f

Please sign in to comment.