Skip to content

Extend Hash.h Crypto library workaround to RP2040/RP2350#386

Open
bdraco wants to merge 1 commit intoESP32Async:mainfrom
bdraco:fix-rp2040-hash-conflict
Open

Extend Hash.h Crypto library workaround to RP2040/RP2350#386
bdraco wants to merge 1 commit intoESP32Async:mainfrom
bdraco:fix-rp2040-hash-conflict

Conversation

@bdraco
Copy link

@bdraco bdraco commented Feb 9, 2026

The ESP8266 codepath in AsyncWebSocket.h already has a workaround for when the Crypto library's Hash.h gets included instead of the framework's version — it checks for the CRYPTO_HASH_h guard and re-includes the correct one via <../src/Hash.h>.

RP2040/RP2350 has the same issue since the Arduino-Pico framework also provides a Hash library with sha1(), but this workaround was never extended when RP2040 support was added.

This showed up in ESPHome CI when web_server (ESPAsyncWebServer) and dsmr (Crypto-no-arduino) are compiled together on RP2040:

AsyncWebSocket.cpp: error: 'sha1' was not declared in this scope

The existing ESP8266 workaround detects when Crypto-no-arduino's Hash.h
is included instead of the framework's Hash library (by checking the
CRYPTO_HASH_h guard) and re-includes the correct one. Extend this to
RP2040/RP2350 platforms which use the same framework Hash library for
sha1().

Also declare Hash as a dependency for the raspberrypi platform in
library.json so PlatformIO resolves it correctly.
@mathieucarbou
Copy link
Member

Thank you @bdraco for these tests, let's see the build output. PR is opened in draft because you are also finishing some testing I guess ?

@bdraco
Copy link
Author

bdraco commented Feb 9, 2026

Just making sure my testing is reproducible before marking as ready

@bdraco
Copy link
Author

bdraco commented Feb 9, 2026

All good. re-confirmed fix

@bdraco bdraco marked this pull request as ready for review February 9, 2026 14:51
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.

2 participants