Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for SSL_set_mtu compat function return code #8330

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2124,14 +2124,17 @@ int wolfSSL_dtls_set_mtu(WOLFSSL* ssl, word16 newMtu)
return WOLFSSL_SUCCESS;
}

#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA)
int wolfSSL_set_mtu_compat(WOLFSSL* ssl, unsigned short mtu) {
if (wolfSSL_dtls_set_mtu(ssl, mtu) == 0)
#ifdef OPENSSL_EXTRA
/* Maps to compatibility API SSL_set_mtu and is same as wolfSSL_dtls_set_mtu,
* 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;
else
return WOLFSSL_FAILURE;
}
#endif /* OPENSSL_ALL || OPENSSL_EXTRA */
#endif /* OPENSSL_EXTRA */

#endif /* WOLFSSL_DTLS && (WOLFSSL_SCTP || WOLFSSL_DTLS_MTU) */

Expand Down Expand Up @@ -12596,6 +12599,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
#endif /* OPENSSL_EXTRA || WOLFSSL_EXTRA || WOLFSSL_WPAS_SMALL */

/* return true if connection established */
/* this works for TLS and DTLS */
int wolfSSL_is_init_finished(const WOLFSSL* ssl)
{
if (ssl == NULL)
Expand Down
4 changes: 4 additions & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -90249,6 +90249,10 @@ static int test_wolfSSL_dtls_set_mtu(void)
ExpectIntEQ(wolfSSL_CTX_dtls_set_mtu(ctx, 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_CTX_free(ctx);
#endif
Expand Down
Loading