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

Compile with Arduino 3 (ESP-IDF 5.1) #13

Merged
merged 5 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions src/AsyncEventSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "Arduino.h"
#include "AsyncEventSource.h"
#include <rom/ets_sys.h>
mathieucarbou marked this conversation as resolved.
Show resolved Hide resolved

static String generateEventMessage(const char *message, const char *event, uint32_t id, uint32_t reconnect){
String ev;
Expand Down
7 changes: 7 additions & 0 deletions src/AsyncWebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#ifndef ESP8266
#include "mbedtls/sha1.h"
#include <rom/ets_sys.h>
#else
#include <Hash.h>
#endif
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/WebAuthentication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading