-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange SSL connection failure: ssl->need_bytes=4621 > 3939 #1375
Comments
@igrr Do you happen to know if the issue I'm having here is the same as #43 (comment) ? |
@igrr Is this the "fragment size" problem you mention #43 (comment) ? |
Yes I think the cause is the same. |
@igrr So for now we can't use SSL for certs with RSA 4096 bit keys? Is that the short answer? |
Sort of, i think the limit is on the total certificate size. Certificate On Thu, Jan 7, 2016, 09:42 Matt Kocaj notifications@github.com wrote:
|
Right. And that's what https://github.com/igrr/axtls-8266/blob/514b6685c5a84232caeed72dc5720c652bbe9f73/ssl/tls1.c#L1283 check is about isn't it? The max. message size? |
Yes it checks if the message will fit into the buffer size. The line where On Thu, Jan 7, 2016, 09:48 Matt Kocaj notifications@github.com wrote:
|
@igrr How do I do that? Is there instructions somewhere on how to recompile the source? |
There is a makefile. Clone the axtls repository, add xtensa toolchain bin On Thu, Jan 7, 2016, 11:29 Matt Kocaj notifications@github.com wrote:
|
@igrr Ok, I think I've done that. I'm assuming I want to use the built |
You need to use the built libaxtls.a and replace On Thu, Jan 7, 2016, 13:55 Matt Kocaj notifications@github.com wrote:
|
Hi, could you tell me where you include this command " configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov");" to fix please start sntp first? |
in the setup before the usage of ssl |
@qblacksheep did you notice I mentioned that the |
I didn,t but in my case it helps. |
@igrr I didn't manage to get the recompiling of axTLS to work. Any other ideas or thoughts as to whether we can work around these certificate lengths? If not, does this then mean that esp simply won't be able to connect to some servers with SSL? Cos that would be a terrible shame right? |
I tried the example shown in the first posting and got this:
Trying api.twilio.com or api.telegram.org: Same result. |
try to enable debug for SSL, may you get more info. |
With "core+SSL":
With "core+WiFi" I got a compilation error:
|
you write above that you use 2.1.0-rc2 but the log shows 2.1.0-rc1. |
Oh! Sorry!
No debug message from SSL. |
@MarcusF2015 try to set debug to "all" |
With "All":
No message from SSL. At other sketches using WIFIClientSecure I will get messages like |
we come at least to this line: Arduino/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp Lines 750 to 751 in 6c8ca2d
but not sure whats goes wrong inside the connect. try to add debug code inside start here: |
Modified WIFIClientSecure quíck and dirty:
This is the result:
|
|
Copy and paste is not clever. New result:
Next? |
follow the function calls until you find the function that returns reason for the fail. |
I think, the ESP does not get an IPAddress for api.github.com. WiFiClient::connect returns 0. I will change it and try again. |
Now it can resolve api.github.com. But there is another problem:
|
Any progress here? Have similar issues. Btw: How did you enable ssl debug output in the end? |
Now it works. Not with 2.0.0. Only with 2.1.0-rc2 and only with api.github.com. Not with api.telegram.org (2048 bytes certificate). The effect is the same as discript in the first posting by cottsak. Choose debug Level "All". https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.md igrr said he could not guarantee it will work for every cert with 2048 bit key: Too less memory for SSL ): |
@MarcusF2015 My conclusion too. Some 4096 and 2048 bit public keys push the memory limit. That's sad I think. esp could have been a really good player in keeping the IoT landscape secure. But unless it can be made to support any SSL key length, it might loose favour with those of us who take a "security first" approach. @igrr Nothing can be done I guess hey? |
I think I got some twilio requests working at some point, so this may probably be solved by tweaking some parameters in TLS library (i.e. how much memory to reserve for connection negotiation stage). Not saying that every cert can be made to work though. |
|
Another 2048 bit SSL key that works: maker.ifttt.com |
@MarcusF2015 No I didn't. Do you have an example request? Also, re the TLS params: I started to do it above. Maybe that can help you. |
@cottsak Fine, I'll try it.
Calculate |
@MarcusF2015 Sorry.. can't explain that mate. I think @igrr is your man. |
@igrr so what's the fix? Have you tweaked those tls values? |
Initial buffer size was increased. I tested with the sketch you posted above. |
@igrr Great work! Thank you! |
The fact that it worked is good. Remember some devices do not have the native intelligence to manage SSL. The fact that this device does is good to know. And igrr, you've done good here. |
@igrr Thanks mate. Is this update only available on the staging feed for now? |
Only in stable (2.1.0). |
@igrr i am getting error compiling axtls-8266: |
@noelgeorgi I think there is something wrong with the environment if Please open an issue on axtls-8266 repository if you can not solve this. Please provide some details so we can help you, i.e. your OS, how you installed xtensa toolchain, can you build other programs with xtensa toolchain and so on. |
I'm locking this topic because the original issue has been fixed. Please open new issue if you have any concern. |
tl;dr
What does
ssl->need_bytes=4621 > 3939
mean? I'm told it's generated from https://github.com/igrr/axtls-8266/blob/514b6685c5a84232caeed72dc5720c652bbe9f73/ssl/tls1.c#L1286 (thanks @Links2004) but I'm not sure how to take this investigation further.Can you reproduce it?
I'm using Arduino 1.6.7 on OS X 10.11.2 and the 2.1.0-rc1 libs.
To reproduce my issue, use this sketch with the Debug Level set to HTTPClient:
You'll notice that using
https://api.github.com/
everything works ok. Sure the request returns a404
but the point is that the certificate SHA1 fingerprint matches and a SSL connection is made.However with Twilio I get this strange
ssl->need_bytes=4621 > 3939
in the debug output and the connection fails. I know the fingerprint is correct so I don't know what is different. On further investigation the only difference between the two certs I can see is the key length: Twilio is 4096 and github is 2048.Can someone please help me out with this?
Bear in mind regarding the
please start sntp first !
, I get this failure wether I includeconfigTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov");
or not.The text was updated successfully, but these errors were encountered: