mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-09-01 10:40:55 +02:00
Compile with Arduino 3 (ESP-IDF 5.x)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
#include "Arduino.h"
|
||||
#include "AsyncEventSource.h"
|
||||
#include <rom/ets_sys.h>
|
||||
|
||||
static String generateEventMessage(const char *message, const char *event, uint32_t id, uint32_t reconnect){
|
||||
String ev;
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#ifndef ESP8266
|
||||
#include "mbedtls/sha1.h"
|
||||
#include <rom/ets_sys.h>
|
||||
#else
|
||||
#include <Hash.h>
|
||||
#endif
|
||||
@@ -1272,9 +1273,15 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket
|
||||
(String&)key += WS_STR_UUID;
|
||||
mbedtls_sha1_context ctx;
|
||||
mbedtls_sha1_init(&ctx);
|
||||
#if ESP_IDF_VERSION_MAJOR == 5
|
||||
mbedtls_sha1_starts(&ctx);
|
||||
mbedtls_sha1_update(&ctx, (const unsigned char*)key.c_str(), key.length());
|
||||
mbedtls_sha1_finish(&ctx, hash);
|
||||
#else
|
||||
mbedtls_sha1_starts_ret(&ctx);
|
||||
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
|
||||
mbedtls_sha1_finish_ret(&ctx, hash);
|
||||
#endif
|
||||
mbedtls_sha1_free(&ctx);
|
||||
#endif
|
||||
base64_encodestate _state;
|
||||
|
@@ -77,9 +77,15 @@ 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);
|
||||
#if ESP_IDF_VERSION_MAJOR == 5
|
||||
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);
|
||||
|
Reference in New Issue
Block a user