Skip to content
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

Fix build on Arduino ESP32 v3.0.0 and IDF 5.1.1 #1349

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/AsyncEventSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "Arduino.h"
#include "AsyncEventSource.h"

#ifdef ESP32
#include "rom/ets_sys.h"
#endif

static String generateEventMessage(const char *message, const char *event, uint32_t id, uint32_t reconnect){
String ev = "";

Expand Down
11 changes: 6 additions & 5 deletions src/AsyncWebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

#include <libb64/cencode.h>

#ifndef ESP8266
#ifdef ESP32
#include "mbedtls/sha1.h"
#include "rom/ets_sys.h"
#else
#include <Hash.h>
#endif
Expand Down Expand Up @@ -829,7 +830,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer)

IPAddress AsyncWebSocketClient::remoteIP() {
if(!_client) {
return IPAddress(0U);
return IPAddress(uint32_t(0));
}
return _client->remoteIP();
}
Expand Down Expand Up @@ -1259,9 +1260,9 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket
(String&)key += WS_STR_UUID;
mbedtls_sha1_context ctx;
mbedtls_sha1_init(&ctx);
mbedtls_sha1_starts_ret(&ctx);
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
mbedtls_sha1_finish_ret(&ctx, hash);
mbedtls_sha1_starts(&ctx);
mbedtls_sha1_update(&ctx, (const unsigned char*)key.c_str(), key.length());
mbedtls_sha1_finish(&ctx, hash);
mbedtls_sha1_free(&ctx);
#endif
base64_encodestate _state;
Expand Down
6 changes: 3 additions & 3 deletions src/WebAuthentication.cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I make this modification, I receive a warning that the "mbedtls_md5_starts()" function is depreciated and superseded by "mbedtls_md5_starts_ret()". Swapping the modified functions back to the original "..._ret()" versions doesn't break the compilability of the code.

Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ 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);
mbedtls_md5_starts(&_ctx);
mbedtls_md5_update(&_ctx, data, len);
mbedtls_md5_finish(&_ctx, _buf);
#else
MD5Init(&_ctx);
MD5Update(&_ctx, data, len);
Expand Down
Loading