Commit 09038554 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

secur32: Use gnutls_record_get_max_size() to get the maximum message size.

parent 6cfa9629
...@@ -821,13 +821,15 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW( ...@@ -821,13 +821,15 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
SecPkgContext_StreamSizes *stream_sizes = buffer; SecPkgContext_StreamSizes *stream_sizes = buffer;
SIZE_T mac_size = info.dwHashStrength; SIZE_T mac_size = info.dwHashStrength;
unsigned int block_size = schan_imp_get_session_cipher_block_size(ctx->session); unsigned int block_size = schan_imp_get_session_cipher_block_size(ctx->session);
unsigned int message_size = schan_imp_get_max_message_size(ctx->session);
TRACE("Using %lu mac bytes, block size %u\n", mac_size, block_size); TRACE("Using %lu mac bytes, message size %u, block size %u\n",
mac_size, message_size, block_size);
/* These are defined by the TLS RFC */ /* These are defined by the TLS RFC */
stream_sizes->cbHeader = 5; stream_sizes->cbHeader = 5;
stream_sizes->cbTrailer = mac_size + 256; /* Max 255 bytes padding + 1 for padding size */ stream_sizes->cbTrailer = mac_size + 256; /* Max 255 bytes padding + 1 for padding size */
stream_sizes->cbMaximumMessage = 1 << 14; stream_sizes->cbMaximumMessage = message_size;
stream_sizes->cbBuffers = 4; stream_sizes->cbBuffers = 4;
stream_sizes->cbBlockSize = block_size; stream_sizes->cbBlockSize = block_size;
} }
......
...@@ -62,6 +62,7 @@ MAKE_FUNCPTR(gnutls_mac_get_key_size); ...@@ -62,6 +62,7 @@ MAKE_FUNCPTR(gnutls_mac_get_key_size);
MAKE_FUNCPTR(gnutls_perror); MAKE_FUNCPTR(gnutls_perror);
MAKE_FUNCPTR(gnutls_protocol_get_version); MAKE_FUNCPTR(gnutls_protocol_get_version);
MAKE_FUNCPTR(gnutls_set_default_priority); MAKE_FUNCPTR(gnutls_set_default_priority);
MAKE_FUNCPTR(gnutls_record_get_max_size);
MAKE_FUNCPTR(gnutls_record_recv); MAKE_FUNCPTR(gnutls_record_recv);
MAKE_FUNCPTR(gnutls_record_send); MAKE_FUNCPTR(gnutls_record_send);
MAKE_FUNCPTR(gnutls_transport_set_errno); MAKE_FUNCPTR(gnutls_transport_set_errno);
...@@ -289,6 +290,11 @@ unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session) ...@@ -289,6 +290,11 @@ unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session)
return schannel_get_cipher_block_size(cipher); return schannel_get_cipher_block_size(cipher);
} }
unsigned int schan_imp_get_max_message_size(schan_imp_session session)
{
return pgnutls_record_get_max_size((gnutls_session_t)session);
}
SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session, SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session,
SecPkgContext_ConnectionInfo *info) SecPkgContext_ConnectionInfo *info)
{ {
...@@ -423,6 +429,7 @@ BOOL schan_imp_init(void) ...@@ -423,6 +429,7 @@ BOOL schan_imp_init(void)
LOAD_FUNCPTR(gnutls_perror) LOAD_FUNCPTR(gnutls_perror)
LOAD_FUNCPTR(gnutls_protocol_get_version) LOAD_FUNCPTR(gnutls_protocol_get_version)
LOAD_FUNCPTR(gnutls_set_default_priority) LOAD_FUNCPTR(gnutls_set_default_priority)
LOAD_FUNCPTR(gnutls_record_get_max_size);
LOAD_FUNCPTR(gnutls_record_recv); LOAD_FUNCPTR(gnutls_record_recv);
LOAD_FUNCPTR(gnutls_record_send); LOAD_FUNCPTR(gnutls_record_send);
LOAD_FUNCPTR(gnutls_transport_set_errno) LOAD_FUNCPTR(gnutls_transport_set_errno)
......
...@@ -628,6 +628,12 @@ unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session) ...@@ -628,6 +628,12 @@ unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session)
} }
} }
unsigned int schan_imp_get_max_message_size(schan_imp_session session)
{
FIXME("Returning 1 << 14.\n");
return 1 << 14;
}
SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session, SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session,
SecPkgContext_ConnectionInfo *info) SecPkgContext_ConnectionInfo *info)
{ {
......
...@@ -196,6 +196,7 @@ extern void schan_imp_set_session_transport(schan_imp_session session, ...@@ -196,6 +196,7 @@ extern void schan_imp_set_session_transport(schan_imp_session session,
struct schan_transport *t) DECLSPEC_HIDDEN; struct schan_transport *t) DECLSPEC_HIDDEN;
extern SECURITY_STATUS schan_imp_handshake(schan_imp_session session) DECLSPEC_HIDDEN; extern SECURITY_STATUS schan_imp_handshake(schan_imp_session session) DECLSPEC_HIDDEN;
extern unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session) DECLSPEC_HIDDEN; extern unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session) DECLSPEC_HIDDEN;
extern unsigned int schan_imp_get_max_message_size(schan_imp_session session) DECLSPEC_HIDDEN;
extern SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session, extern SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session,
SecPkgContext_ConnectionInfo *info) DECLSPEC_HIDDEN; SecPkgContext_ConnectionInfo *info) DECLSPEC_HIDDEN;
extern SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session, extern SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session,
......
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