What is causing intermittent SEC_E_BUFFER_TOO_SMALL error coming from WinHttpSendRequest?

♀尐吖头ヾ 提交于 2019-12-05 10:06:48
Nicholas Smith

I was provided an answer by someone offline and find it very interesting.

During the key exchange that occurs in TLS 1.2 with RSA+ECDHE, the 256-byte (2048-bit) public modulus integer of ECDHE is generated randomly, and as such it will occasionally have a high order byte of zero. In this situation, the server being used (some Linux box with OpenSSL, do not know distro or version of anything) sends the integer using 255 bytes instead of 256.

The WinHTTP code which receives the public modulus integer in its slightly shorter form apparently does not handle it correctly. It is worth noting that I have not yet seen this problem reproduced on Windows 7 with all software updates, but see it quite often on Windows 8 (Windows 10 not yet tested).

This bug report in Microsoft Edge confirms the same behavior, just with a 1024-bit modulus instead of 2048, but probably it is the same problem:

TLS ServerKeyExchange with 1024 DHE may encode dh_Y as 127 bytes, breaking Internet Explorer 11

However, it does make me wonder if OpenSSL should be padding the integer. I have not looked for the actual spec to see what is the allowed behavior(s) in this situation.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!