Repository navigation
Add timer functions - #60
Open
padelsbach wants to merge 1 commit into
Open
padelsbach wants to merge 1 commit into
padelsbach wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The timer fallback mixes monotonic and wall-clock timestamps when clock reads fail, producing enormous elapsed values that can cause delays to expire prematurely.
1 open issue
What changed in this PR
Adds four timer APIs to the Mbed TLS compatibility layer, enabled by MBEDTLS_TIMING_C on Windows and Unix-like systems.
Changes:
- Implements timer and delay APIs with platform clock support and shared-library exports.
- Adds timer unit tests and a
load_rootsintegration case. - Documents timer availability and test coverage.
| File | Description |
|---|---|
wolfpsa/mbedtls_compat/mbedtls/timing.h |
Declares timer contexts and four public APIs. |
wolfpsa.map |
Exports timing symbols. |
tools/psa_want_probe.c |
Enables timing support on supported platforms. |
test/mbedtls_compat/timing_test.c |
Tests elapsed time, delays, cancellation, and null arguments. |
test/mbedtls_compat/programs.sh |
Adds load_roots and supports server-free cases. |
test/mbedtls_compat/Makefile |
Builds timer tests and load_roots. |
src/mbedtls/timing.c |
Implements clock reads and timer operations. |
README.md |
Documents timer support and unit tests. |
Review effort: Balanced
padelsbach
requested review from
Frauschi
and
a balanced review from Copilot
November 17, 2026 06:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds 4 timer functions enabled with
MBEDTLS_TIMING_C:get_timer,set_delay,get_delayandget_final_delay