error handling with wrong PSK handshake
Status: Alpha
Brought to you by:
obgm
In case the tinydtls client is used against a server with wrong PSK secret, no error is pushed back to the user, using error code.
From what I understand of the code in the dtls.c dtls_handle_message function there is something wrong:
handle_alert() is called but the error return code is not correctly tested
how I fixed the problem:
err = handle_alert(ctx, peer, msg, data, data_length);
if (err < 0 || err == 1) {
dtls_warn("received wrong package\n");
/ handle alert has invalidated peer /
peer = NULL;
return -1;
}
break;
Now I correctly receive an error and can close my session
here a patch
Thanks!
Applied the proposed patch