Skip to content

IDE/iotsafe: fix memory TLS wrapper and example build#10457

Merged
dgarske merged 2 commits into
wolfSSL:masterfrom
danielinux:iotsafe-fix-tls-wrapper
May 12, 2026
Merged

IDE/iotsafe: fix memory TLS wrapper and example build#10457
dgarske merged 2 commits into
wolfSSL:masterfrom
danielinux:iotsafe-fix-tls-wrapper

Conversation

@danielinux
Copy link
Copy Markdown
Member

Revived and fixed IoT-Safe example, including:

  • Hardened the memory_tls wolfSSL I/O wrapper in IDE/iotsafe/memory-tls.c:74 by centralizing send/recv handling, validating pointers and indices, enforcing sz > 0 and sz <= TLS_BUFFERS_SZ, and preventing out-
    of-bounds copies.
  • Fixed the callback behavior in ServerSend / ServerRecv / ClientSend / ClientRecv so they return WANT_READ or WANT_WRITE only when no progress is possible, while safely handling partial in-memory transfers.
  • Added missing error handling for wolfSSL_CTX_iotsafe_enable() and wolfSSL_iotsafe_on_ex() in IDE/iotsafe/memory-tls.c:242 and IDE/iotsafe/memory-tls.c:333.
  • Fixed the server-side receive path to NUL-terminate the received buffer before printing it as a C string in IDE/iotsafe/memory-tls.c:466.
  • Fixed the BSP header in IDE/iotsafe/devices.h:28 by adding the missing <stdint.h> include.
  • Fixed the example configuration in IDE/iotsafe/user_settings.h:120 by removing the invalid WOLFSSL_SP_MATH + WOLFSSL_SP_MATH_ALL combination and adding WOLFSSL_NO_SOCK for this bare-metal build.
  • Fixed the example linker collision in IDE/iotsafe/devices.c:231 by removing the redundant _sbrk_r definition that conflicts with current newlib.

Copilot AI review requested due to automatic review settings May 11, 2026 18:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Revives the IoT-Safe memory-TLS example by hardening the in-memory wolfSSL I/O callbacks and fixing several build/runtime issues in the example configuration and BSP stubs.

Changes:

  • Centralizes and hardens in-memory send/recv logic for wolfSSL CBIO callbacks, including partial transfer handling and additional error checking for IoT-Safe enablement.
  • Updates example build configuration (feature flags / no-sockets) and BSP headers for correctness.
  • Removes a redundant _sbrk_r that collides with newer newlib implementations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
IDE/iotsafe/user_settings.h Adjusts wolfSSL feature defines for the bare-metal example (adds WOLFSSL_NO_SOCK).
IDE/iotsafe/memory-tls.c Refactors CBIO send/recv into helpers, adds error handling for IoT-Safe enablement, and NUL-terminates server-received data before printing.
IDE/iotsafe/devices.h Adds missing <stdint.h> include for fixed-width types.
IDE/iotsafe/devices.c Removes conflicting _sbrk_r implementation to fix linker collision with newlib.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread IDE/iotsafe/memory-tls.c Outdated
Comment thread IDE/iotsafe/memory-tls.c Outdated
Comment thread IDE/iotsafe/memory-tls.c
@github-actions
Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@dgarske
Copy link
Copy Markdown
Member

dgarske commented May 12, 2026

Jenkins retest this please. History lost for PRB master

@dgarske dgarske merged commit f8bc0ce into wolfSSL:master May 12, 2026
437 of 438 checks passed
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.

4 participants