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

Conversation

blackhack
Copy link
Contributor

This fixes compilation on the latest Git version of the Arduino ESP32 core due to API changes in IDF 5.1.

Of course, these changes make ESPAsyncWebServer incompatible with prior Arduino core versions.

@rel1ct
Copy link

rel1ct commented Oct 16, 2023

In WebAuthentication.cpp -> #ifdef ESP32 + #include "esp_idf_version.h"

if(ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 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);
}

In AsyncWebSocket.cpp
change
#ifdef ESP8266
#include "mbedtls/sha1.h"
#elif ESP32
#include "mbedtls/sha1.h"
#include "rom/ets_sys.h"
#include "esp_idf_version.h"
#else
#include <Hash.h>
#endif

if(ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)){
mbedtls_sha1_starts_ret(&ctx);
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
mbedtls_sha1_finish_ret(&ctx, hash);
}else{
mbedtls_sha1_starts(&ctx);
mbedtls_sha1_update(&ctx, (const unsigned char*)key.c_str(), key.length());
mbedtls_sha1_finish(&ctx, hash);
}

@blackhack blackhack closed this Oct 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants