Skip to content

V2#6

Open
zekageri wants to merge 5 commits intomainfrom
v2
Open

V2#6
zekageri wants to merge 5 commits intomainfrom
v2

Conversation

@zekageri
Copy link
Copy Markdown
Collaborator

@zekageri zekageri commented Apr 7, 2026

Summary

  • Fix esp-crypto CI build failures across Arduino examples, PlatformIO, and the ESP-IDF smoke example.
  • The PR makes the internal crypto/JWT headers more robust across build environments, fixes ESP-IDF component wiring, and updates examples to include the headers they directly depend on.
  • Related issues: none linked.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (code change that neither fixes a bug nor adds a feature)
  • Documentation update
  • Build/CI

Details

  • Fix invalid cross-translation-unit access to CryptoKey::PkCache by routing asymmetric signing/verification through a narrow accessor instead of dereferencing the opaque cache type directly.
  • Add esp_timer to the ESP-IDF component REQUIRES list so esp_timer.h usage is declared correctly for the component build.
  • Make internal JWT declarations conditional on ArduinoJson availability and include JWT definitions explicitly where needed, instead of relying on transitive include side effects.
  • Fix ESP random source detection by including esp_random.h and keying esp_fill_random usage off that header rather than assuming esp_system.h provides the declaration.
  • Fix Arduino example macro collisions by renaming local HEX lookup tables.
  • Update JWT-based Arduino examples to include ArduinoJson.h and esp_crypto/jwt.h explicitly.

Context for reviewers:

  • The failures were coming from three different build paths that each exposed a different assumption in the codebase: opaque type visibility, ESP-IDF component dependency declaration, and Arduino/example header discovery.
  • The changes are intentionally narrow and focused on build correctness rather than API redesign.

Testing

  • Builds locally
  • Unit tests added/updated
  • Tested on target hardware/device (if applicable)

Testing performed:

  • Investigated and fixed failures based on GitHub Actions logs for:
    • Arduino examples on esp32dev
    • PlatformIO example build on esp32-p4-evboard
    • examples/esp_idf_core_smoke
  • git diff --check passed locally.
  • Local full builds were not run in this environment because the required toolchains/utilities were unavailable (cmake and ESP toolchains were not installed here).

Compatibility / Breaking Changes

  • No intended API or behavior breaking changes.
  • Public functionality is unchanged; the PR primarily fixes build portability and example compilation.
  • No migration steps should be required for users.

Risks and Mitigations

  • Risk: conditional JWT/internal include changes could affect builds where ArduinoJson is absent or discovered differently.
    • Mitigation: JWT-only internals are now explicitly gated behind ArduinoJson availability, which is safer than relying on indirect includes.
  • Risk: platform header detection may vary between Arduino and ESP-IDF environments.
    • Mitigation: the code now checks for the specific headers actually needed (esp_timer.h, esp_random.h) instead of assuming one umbrella header is sufficient.

Checklist

  • Code follows project style and conventions
  • All tests pass locally
  • Documentation updated (README, examples, comments)
  • No secrets, credentials, or sensitive data committed
  • Linked issue(s) and relevant context provided

Environment

  • Toolchain/SDK versions:
    • Arduino esp32:esp32 3.3.3
    • ESP-IDF v5.4
    • PlatformIO Espressif32 55.3.37+sha.a9fac07
    • toolchain-riscv32-esp 14.2.0+20251107
    • ArduinoJson 7.4.3
  • OS and version:
    • GitHub Actions Ubuntu runner
  • Other relevant environment details:
    • Affected targets included esp32dev and esp32-p4-evboard
    • Failures reproduced from CI logs rather than local toolchain runs

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.

1 participant