Commit a114ce67 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

secur32: Add support for setting DTLS MTU.

parent f93284df
......@@ -879,6 +879,13 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
schan_imp_set_application_protocols(ctx->session, buffer->pvBuffer, buffer->cbBuffer);
}
if (pInput && (idx = schan_find_sec_buffer_idx(pInput, 0, SECBUFFER_DTLS_MTU)) != -1)
{
buffer = &pInput->pBuffers[idx];
if (buffer->cbBuffer >= sizeof(WORD)) schan_imp_set_dtls_mtu(ctx->session, *(WORD *)buffer->pvBuffer);
else WARN("invalid buffer size %u\n", buffer->cbBuffer);
}
phNewContext->dwLower = handle;
phNewContext->dwUpper = 0;
}
......
......@@ -53,6 +53,7 @@ static int (*pgnutls_cipher_get_block_size)(gnutls_cipher_algorithm_t);
/* Not present in gnutls version < 3.0. */
static void (*pgnutls_transport_set_pull_timeout_function)(gnutls_session_t,
int (*)(gnutls_transport_ptr_t, unsigned int));
static void (*pgnutls_dtls_set_mtu)(gnutls_session_t, unsigned int);
/* Not present in gnutls version < 3.2.0. */
static int (*pgnutls_alpn_get_selected_protocol)(gnutls_session_t, gnutls_datum_t *);
......@@ -186,6 +187,11 @@ static int compat_gnutls_alpn_set_protocols(gnutls_session_t session, const gnut
return GNUTLS_E_INVALID_REQUEST;
}
static void compat_gnutls_dtls_set_mtu(gnutls_session_t session, unsigned int mtu)
{
FIXME("\n");
}
static ssize_t schan_pull_adapter(gnutls_transport_ptr_t transport,
void *buff, size_t buff_len)
{
......@@ -767,6 +773,15 @@ SECURITY_STATUS schan_imp_get_application_protocol(schan_imp_session session,
return SEC_E_OK;
}
SECURITY_STATUS schan_imp_set_dtls_mtu(schan_imp_session session, unsigned int mtu)
{
gnutls_session_t s = (gnutls_session_t)session;
pgnutls_dtls_set_mtu(s, mtu);
TRACE("MTU set to %u\n", mtu);
return SEC_E_OK;
}
static WCHAR *get_key_container_path(const CERT_CONTEXT *ctx)
{
static const WCHAR rsabaseW[] =
......@@ -1130,6 +1145,11 @@ BOOL schan_imp_init(void)
WARN("gnutls_alpn_get_selected_protocol not found\n");
pgnutls_alpn_get_selected_protocol = compat_gnutls_alpn_get_selected_protocol;
}
if (!(pgnutls_dtls_set_mtu = dlsym(libgnutls_handle, "gnutls_dtls_set_mtu")))
{
WARN("gnutls_dtls_set_mtu not found\n");
pgnutls_dtls_set_mtu = compat_gnutls_dtls_set_mtu;
}
if (!(pgnutls_privkey_export_x509 = dlsym(libgnutls_handle, "gnutls_privkey_export_x509")))
{
WARN("gnutls_privkey_export_x509 not found\n");
......
......@@ -1213,6 +1213,12 @@ SECURITY_STATUS schan_imp_get_application_protocol(schan_imp_session session,
return SEC_E_UNSUPPORTED_FUNCTION;
}
SECURITY_STATUS schan_imp_set_dtls_mtu(schan_imp_session session, unsigned int mtu)
{
FIXME("no support for setting dtls mtu on this platform\n");
return SEC_E_UNSUPPORTED_FUNCTION;
}
BOOL schan_imp_init(void)
{
TRACE("()\n");
......
......@@ -253,5 +253,6 @@ extern void schan_imp_deinit(void) DECLSPEC_HIDDEN;
extern void schan_imp_set_application_protocols(schan_imp_session, unsigned char *, unsigned int) DECLSPEC_HIDDEN;
extern SECURITY_STATUS schan_imp_get_application_protocol(schan_imp_session,
SecPkgContext_ApplicationProtocol *) DECLSPEC_HIDDEN;
extern SECURITY_STATUS schan_imp_set_dtls_mtu(schan_imp_session, unsigned int) DECLSPEC_HIDDEN;
#endif /* ndef __SECUR32_PRIV_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment