Skip to content

Commit 171c740

Browse files
authored
Merge pull request #15 from Aircoookie/arduino-3
Merge ESP32 arduino 3.0x patches from upstream
2 parents 41a2267 + da5067c commit 171c740

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-DASYNCWEBSERVER_REGEX=1

src/AsyncEventSource.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
*/
2020
#include "Arduino.h"
2121
#include "AsyncEventSource.h"
22+
#ifdef ESP32
23+
#if ESP_IDF_VERSION_MAJOR >= 5
24+
#include "rom/ets_sys.h"
25+
#endif
26+
#endif
2227

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

src/AsyncWebSocket.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#else
2929
#include <Hash.h>
3030
#endif
31+
#ifdef ESP32
32+
#if ESP_IDF_VERSION_MAJOR >= 5
33+
#include "rom/ets_sys.h"
34+
#endif
35+
#endif
3136

3237
#ifdef ASYNCWEBSERVER_DEBUG_TRACE
3338
#define DEBUG_PRINTFP(fmt, ...) Serial.printf_P(PSTR("[%u]{%d}" fmt "\n"), (unsigned) millis(), ESP.getFreeHeap(), ##__VA_ARGS__)
@@ -829,7 +834,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer* buffer)
829834

830835
IPAddress AsyncWebSocketClient::remoteIP() {
831836
if(!_client) {
832-
return IPAddress((uint32_t)0);
837+
return IPAddress((uint32_t)0U);
833838
}
834839
return _client->remoteIP();
835840
}
@@ -1231,9 +1236,15 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket
12311236
(String&)key += FPSTR(WS_STR_UUID);
12321237
mbedtls_sha1_context ctx;
12331238
mbedtls_sha1_init(&ctx);
1239+
#if ESP_IDF_VERSION_MAJOR < 5
12341240
mbedtls_sha1_starts_ret(&ctx);
12351241
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
12361242
mbedtls_sha1_finish_ret(&ctx, hash);
1243+
#else
1244+
mbedtls_sha1_starts(&ctx);
1245+
mbedtls_sha1_update(&ctx, (const unsigned char*)key.c_str(), key.length());
1246+
mbedtls_sha1_finish(&ctx, hash);
1247+
#endif
12371248
mbedtls_sha1_free(&ctx);
12381249
#endif
12391250
base64_encodestate _state;

src/WebAuthentication.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo
6868
uint8_t _buf[16] = {0};
6969
#ifdef ESP32
7070
mbedtls_md5_init(&_ctx);
71+
#if ESP_IDF_VERSION_MAJOR < 5
7172
mbedtls_md5_starts_ret(&_ctx);
7273
mbedtls_md5_update_ret(&_ctx, data, len);
7374
mbedtls_md5_finish_ret(&_ctx, _buf);
75+
#else
76+
mbedtls_md5_starts(&_ctx);
77+
mbedtls_md5_update(&_ctx, data, len);
78+
mbedtls_md5_finish(&_ctx, _buf);
79+
#endif
7480
#else
7581
MD5Init(&_ctx);
7682
MD5Update(&_ctx, data, len);

0 commit comments

Comments
 (0)