diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp index f76f2fc96..e72c00108 100644 --- a/src/AsyncWebSocket.cpp +++ b/src/AsyncWebSocket.cpp @@ -829,7 +829,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer) IPAddress AsyncWebSocketClient::remoteIP() { if(!_client) { - return IPAddress(0U); + return IPAddress((uint32_t) 0); } return _client->remoteIP(); } diff --git a/src/AsyncWebSocket.h b/src/AsyncWebSocket.h index 5b03aceb9..c07f35785 100644 --- a/src/AsyncWebSocket.h +++ b/src/AsyncWebSocket.h @@ -21,8 +21,13 @@ #ifndef ASYNCWEBSOCKET_H_ #define ASYNCWEBSOCKET_H_ +#if (MBEDTLS_VERSION_NUMBER >= 0x02070000) + //#error Must use ESP32 core v1.0.6-, with MBEDTLS_VERSION_NUMBER < v2.7.0 +#endif + #include #ifdef ESP32 +#include "mbedtls/version.h" #include #define WS_MAX_QUEUED_MESSAGES 32 #else diff --git a/src/WebAuthentication.cpp b/src/WebAuthentication.cpp index 45246a196..13b6e79a1 100644 --- a/src/WebAuthentication.cpp +++ b/src/WebAuthentication.cpp @@ -22,6 +22,7 @@ #include #ifdef ESP32 #include "mbedtls/md5.h" +#include "mbedtls/version.h" #else #include "md5.h" #endif @@ -71,9 +72,16 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo memset(_buf, 0x00, 16); #ifdef ESP32 mbedtls_md5_init(&_ctx); - mbedtls_md5_starts_ret(&_ctx); - mbedtls_md5_update_ret(&_ctx, data, len); - mbedtls_md5_finish_ret(&_ctx, _buf); + #if (MBEDTLS_VERSION_NUMBER < 0x02070000) + // Superseded from v2.7.0 + mbedtls_md5_starts(&_ctx); + mbedtls_md5_update(&_ctx, data, len); + mbedtls_md5_finish(&_ctx, _buf); + #else + mbedtls_md5_starts_ret(&_ctx); + mbedtls_md5_update_ret(&_ctx, data, len); + mbedtls_md5_finish_ret(&_ctx, _buf); + #endif #else MD5Init(&_ctx); MD5Update(&_ctx, data, len);