[PATCH 2/3] Store header and trailer byte counts in schan_context for future use
Mikko Rasa
tdb at tdb.fi
Mon Aug 30 11:37:38 CDT 2010
---
dlls/secur32/schannel.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 70458fa..ef24656 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -97,6 +97,8 @@ struct schan_credentials
struct schan_context
{
gnutls_session_t session;
+ ULONG header_bytes;
+ ULONG trailer_bytes;
ULONG req_ctx_attr;
};
@@ -747,6 +749,9 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
phNewContext->dwLower = handle;
phNewContext->dwUpper = 0;
+
+ ctx->header_bytes = 5;
+ ctx->trailer_bytes = 0; /* Will be filled when handshake is completed */
}
else
{
@@ -777,6 +782,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
switch(err)
{
case GNUTLS_E_SUCCESS:
+ ctx->trailer_bytes = pgnutls_mac_get_key_size(pgnutls_mac_get(ctx->session));
TRACE("Handshake completed\n");
return SEC_E_OK;
@@ -943,16 +949,14 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
case SECPKG_ATTR_STREAM_SIZES:
{
SecPkgContext_StreamSizes *stream_sizes = buffer;
- gnutls_mac_algorithm_t mac = pgnutls_mac_get(ctx->session);
- size_t mac_size = pgnutls_mac_get_key_size(mac);
gnutls_cipher_algorithm_t cipher = pgnutls_cipher_get(ctx->session);
unsigned int block_size = schannel_get_cipher_block_size(cipher);
- TRACE("Using %zu mac bytes, block size %u\n", mac_size, block_size);
+ TRACE("Using %u trailer bytes, block size %u\n", ctx->trailer_bytes, block_size);
/* These are defined by the TLS RFC */
- stream_sizes->cbHeader = 5;
- stream_sizes->cbTrailer = mac_size + 256; /* Max 255 bytes padding + 1 for padding size */
+ stream_sizes->cbHeader = ctx->header_bytes;
+ stream_sizes->cbTrailer = ctx->trailer_bytes;
stream_sizes->cbMaximumMessage = 1 << 14;
stream_sizes->cbBuffers = 4;
stream_sizes->cbBlockSize = block_size;
--
1.7.1
More information about the wine-patches
mailing list