runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Update the Trailer Size with the correct value which vaires with the protocol used

Open shrutigarg opened this issue 11 years ago • 5 comments

This is to track the changes needed to update the Trailer size value in StreamSizes with the correct value

shrutigarg avatar Oct 29 '15 10:10 shrutigarg

OpenSsl does not provide any macros or APIs to retrieve the header/trailer values. The values can change depending on the protocol and the ciphers being used in the low-level message exchanges.

Note that this has no functionality impact since the xplat code of System.Net.Security uses this only to compute the buffer size to be allocated for encrypted data. So a value higher than actual by a few bytes does not affect the logic. Also there are checks in place to guard against buffer overruns

vijaykota avatar Oct 29 '15 11:10 vijaykota

Lowering the priority to "Future"

vijaykota avatar Dec 11 '15 04:12 vijaykota

This is the root cause of RC2 escrow issue dotnet/corefx#7599.

bartonjs avatar Apr 12 '16 22:04 bartonjs

The way we have set the max trailer size to 68, we would need to do the same for header also. Since as said we don't have a way to retrieve the header/trailer values from libssl .We can set it the max value it can ever happen.. I had done some investigations during implementation around the header/trailer values that can happen in various protocols.. My findings were (when try to connect as windows client to Linux server)

SSL3: header : 5 max : 16384

TLS: header : 5 max : 16384

TLS11: header : 21 max : 16384

TLS12: header : 13 max : 16384

And this not only depends on the protocol but the cipher algorithms which are negotiated during connection .

We can increase the Header size value to 21( max among all) to get it working for all scenarios ..

And yes, we do have a test case which tests write with large data (>16k bytes). but seems it does not use "ECDHE-RSA-AES256-SHA384 " cipher which caused the failure .

And since there is no way to enforce the ciphers to be used during a connection through the any API or any other mean, It is not possible to add the exact testcase to repro this . See the similar issue raised for cipher related tests : https://github.com/dotnet/corefx/issues/3832 .

BTW, I was able to repro the issue dotnet/corefx#7599 by running my server as "openssl s_server -cert mycert.pem -www -debug -cipher ECDHE-RSA-AES256-SHA384"

And writing the data >8000 bytes from a Linux client.. and saw the Assert happening. With Header size set to 21 ,, it was succeeding.

shrutigarg avatar Apr 13 '16 13:04 shrutigarg

The header/trailer sizes are no longer being read for Unix builds. So a new function should be added which

  • Accepts the SSL* to see what protocol it is using
  • Emits only the maximum message framing size for the protocol.

bartonjs avatar Apr 14 '16 22:04 bartonjs