DTLS Nonblocking Updates

1. Add error code for trying to retransmit a flight when transmitting
the flight hasn't finished.
2. Add function to retransmit the stored flight without updating the
timeout count.
This commit is contained in:
John Safranek
2018-12-13 15:23:29 -08:00
parent 91d81ea691
commit 63f6c1d280
4 changed files with 26 additions and 0 deletions

View File

@@ -15836,6 +15836,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
case EXT_MISSING:
return "Required TLS extension missing";
case DTLS_RETX_OVER_TX:
return "DTLS interrupting flight transmit with retransmit";
default :
return "unknown error number";
}

View File

@@ -8827,6 +8827,27 @@ int wolfSSL_dtls_got_timeout(WOLFSSL* ssl)
return result;
}
/* retransmit all the saves messages, WOLFSSL_SUCCESS on ok */
int wolfSSL_dtls_retransmit(WOLFSSL* ssl)
{
WOLFSSL_ENTER("wolfSSL_dtls_retransmit()");
if (ssl == NULL)
return WOLFSSL_FATAL_ERROR;
if (!ssl->options.handShakeDone) {
int result = DtlsMsgPoolSend(ssl, 0);
if (result < 0) {
ssl->error = result;
WOLFSSL_ERROR(result);
return WOLFSSL_FATAL_ERROR;
}
}
return 0;
}
#endif /* DTLS */
#endif /* LEANPSK */

View File

@@ -163,6 +163,7 @@ enum wolfSSL_ErrorCodes {
EXT_MISSING = -428, /* Required extension not found */
UNSUPPORTED_EXTENSION = -429, /* TLSX not requested by client */
PRF_MISSING = -430, /* PRF not compiled in */
DTLS_RETX_OVER_TX = -431, /* Retransmit DTLS flight over */
/* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
/* begin negotiation parameter errors */

View File

@@ -723,6 +723,7 @@ WOLFSSL_API int wolfSSL_dtls_get_current_timeout(WOLFSSL* ssl);
WOLFSSL_API int wolfSSL_dtls_set_timeout_init(WOLFSSL* ssl, int);
WOLFSSL_API int wolfSSL_dtls_set_timeout_max(WOLFSSL* ssl, int);
WOLFSSL_API int wolfSSL_dtls_got_timeout(WOLFSSL* ssl);
WOLFSSL_API int wolfSSL_dtls_retransmit(WOLFSSL*);
WOLFSSL_API int wolfSSL_dtls(WOLFSSL* ssl);
WOLFSSL_API int wolfSSL_dtls_set_peer(WOLFSSL*, void*, unsigned int);