Fix for SSL_set_mtu -> wolfSSL_set_mtu_compat return code. Update comment for wolfSSL_is_init_finished indicating it works for TLS and DTLS.

This commit is contained in:
David Garske
2025-01-03 09:55:47 -08:00
parent 239b85c804
commit d6440be4a9
2 changed files with 12 additions and 4 deletions

View File

@@ -2124,14 +2124,17 @@ int wolfSSL_dtls_set_mtu(WOLFSSL* ssl, word16 newMtu)
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
} }
#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) #ifdef OPENSSL_EXTRA
int wolfSSL_set_mtu_compat(WOLFSSL* ssl, unsigned short mtu) { /* Maps to compatibility API SSL_set_mtu and is same as wolfSSL_dtls_set_mtu,
if (wolfSSL_dtls_set_mtu(ssl, mtu) == 0) * but expects only success or failure returns. */
int wolfSSL_set_mtu_compat(WOLFSSL* ssl, unsigned short mtu)
{
if (wolfSSL_dtls_set_mtu(ssl, mtu) == WOLFSSL_SUCCESS)
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
else else
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
} }
#endif /* OPENSSL_ALL || OPENSSL_EXTRA */ #endif /* OPENSSL_EXTRA */
#endif /* WOLFSSL_DTLS && (WOLFSSL_SCTP || WOLFSSL_DTLS_MTU) */ #endif /* WOLFSSL_DTLS && (WOLFSSL_SCTP || WOLFSSL_DTLS_MTU) */
@@ -12596,6 +12599,7 @@ cleanup:
#endif /* OPENSSL_EXTRA || WOLFSSL_EXTRA || WOLFSSL_WPAS_SMALL */ #endif /* OPENSSL_EXTRA || WOLFSSL_EXTRA || WOLFSSL_WPAS_SMALL */
/* return true if connection established */ /* return true if connection established */
/* this works for TLS and DTLS */
int wolfSSL_is_init_finished(const WOLFSSL* ssl) int wolfSSL_is_init_finished(const WOLFSSL* ssl)
{ {
if (ssl == NULL) if (ssl == NULL)

View File

@@ -90249,6 +90249,10 @@ static int test_wolfSSL_dtls_set_mtu(void)
ExpectIntEQ(wolfSSL_CTX_dtls_set_mtu(ctx, 1488), WOLFSSL_SUCCESS); ExpectIntEQ(wolfSSL_CTX_dtls_set_mtu(ctx, 1488), WOLFSSL_SUCCESS);
ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl, 1488), WOLFSSL_SUCCESS); ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl, 1488), WOLFSSL_SUCCESS);
#ifdef OPENSSL_EXTRA
ExpectIntEQ(SSL_set_mtu(ssl, 1488), WOLFSSL_SUCCESS);
#endif
wolfSSL_free(ssl); wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx); wolfSSL_CTX_free(ctx);
#endif #endif