Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.87k stars 553 forks source link

Esp8266 does not appear to support This is deprecated AxTLS API causing compile warnings #557

Closed wangmings closed 3 years ago

wangmings commented 4 years ago
/Users/mac/.platformio/lib/WebSockets/src/WebSocketsClient.cpp: In member function 'void WebSocketsClient::loop()':
/Users/mac/.platformio/lib/WebSockets/src/WebSocketsClient.cpp:173:87: warning: 'bool BearSSL::WiFiClientSecure::setCACert(const uint8_t*, size_t)' is deprecated (declared at /Users/mac/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h:142): This is deprecated AxTLS API, check https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/WiFiClientSecure.h#L25-L99 [-Wdeprecated-declarations]
                 _client.ssl->setCACert((const uint8_t *)_CA_cert, strlen(_CA_cert) + 1);
                                                                                       ^
/Users/mac/.platformio/lib/WebSockets/src/WebSocketsClient.cpp: In member function 'void WebSocketsClient::connectedCb()':
/Users/mac/.platformio/lib/WebSockets/src/WebSocketsClient.cpp:761:68: warning: 'bool BearSSL::WiFiClientSecure::verify(const char*, const char*)' is deprecated (declared at /Users/mac/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h:182): This is deprecated AxTLS API, check https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/WiFiClientSecure.h#L25-L99 [-Wdeprecated-declarations]
         if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
Links2004 commented 4 years ago

the warnings are know, the problem is that there is no direct replacement for them in the new BearSSL the ESP8266 is using.

the only way to remove the warnings is to remove the functions which will break existing code, for the reason I have not "fixed" them yet. currently I only plan to remove them when there are clear indication that the functions are removed on the ESP.

wangmings commented 4 years ago

Thanks for your reply! Hope to repair the warning part as soon as possible! A new version!

luc-github commented 3 years ago

@Links2004 Hi this is an heads up : due to recent Remove stray axtls refs, deprecated compat funcs https://github.com/esp8266/Arduino/commit/85ba53a24994db5ec2aff3b7adfa05330a637413

arduino Websocket library is no more compilling, axtls API is not only deprecated but now API is also removed

C:\Users\luc\Documents\Arduino\libraries\arduinoWebSockets-2.2.0\src\WebSocketsClient.cpp: In member function 'void WebSocketsClient::loop()':
C:\Users\luc\Documents\Arduino\libraries\arduinoWebSockets-2.2.0\src\WebSocketsClient.cpp:173:30: error: 'class BearSSL::WiFiClientSecure' has no member named 'setCACert'
  173 |                 _client.ssl->setCACert((const uint8_t *)_CA_cert, strlen(_CA_cert) + 1);
      |                              ^~~~~~~~~
C:\Users\luc\Documents\Arduino\libraries\arduinoWebSockets-2.2.0\src\WebSocketsClient.cpp: In member function 'void WebSocketsClient::connectedCb()':
C:\Users\luc\Documents\Arduino\libraries\arduinoWebSockets-2.2.0\src\WebSocketsClient.cpp:759:26: error: 'class BearSSL::WiFiClientSecure' has no member named 'verify'
  759 |         if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
      | 

So the coming 3.0 core break backward compatibility with axtls API

Links2004 commented 3 years ago

ok, thanks for the info. will change the code, hope I find a way to auto detect the new version to not break backward compatibility for 2.x

luc-github commented 3 years ago

I do not know if it can help but there are : in core _version.h of 2.7.4

#define ARDUINO_ESP8266_GIT_VER 0x2843a5ac
#define ARDUINO_ESP8266_GIT_DESC 2.7.3-3-g2843a5ac
#define ARDUINO_ESP8266_RELEASE_2_7_4
#define ARDUINO_ESP8266_RELEASE "2_7_4"

when in git version

#ifndef ARDUINO_ESP8266_GIT_VER
#define ARDUINO_ESP8266_GIT_VER 0x00000000
#endif

#ifndef ARDUINO_ESP8266_GIT_DESC
#define ARDUINO_ESP8266_GIT_DESC unspecified
#endif
Links2004 commented 3 years ago

thanks,

currently I am using:

#if defined(wificlientbearssl_h) && !defined(USING_AXTLS) && !defined(wificlientsecure_h)
#define SSL_BARESSL
#else
#define SSL_AXTLS
#endif
Links2004 commented 3 years ago

new version 2.3.0 will be released soon, git master is uptodate. feel free to reopen, if problem still exists.

luc-github commented 3 years ago

I confirm compilation is ok too - Thank you so much for this impressively fast response ^_^