Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The host-based OP-TEE test additions have no active review issues.
No open issues 🎉
What changed in this PR
Adds host-based tests for the fwTPM OP-TEE trusted application port introduced in #659, extending coverage beyond hardware testing with a mock TEE.
Changes:
- Adds RAM-backed secure storage and injectable TEE failures.
- Integrates stubbed-core port tests into
make checkand adds real-core tests for session ownership and NV persistence. - Adds standard and sanitizer CI runs against pinned wolfSSL, with nightly runs against master.
| File | Description |
|---|---|
tests/optee/user_settings.h |
Configures wolfCrypt and fwTPM for host core tests. |
tests/optee/tee_internal_api.h |
Declares the mocked TEE API subset. |
tests/optee/tee_internal_api_extensions.h |
Provides the port-compatible extension header. |
tests/optee/README.md |
Documents both suites and build commands. |
tests/optee/pta_system.h |
Defines the mock system PTA interface. |
tests/optee/optee_core.mk |
Builds the port with real fwTPM and wolfCrypt sources. |
tests/optee/optee_core_tests.c |
Tests ownership, persistence, MAC rejection and INOUT responses. |
tests/optee/mock_tee.h |
Exposes mock storage controls and fault injection. |
tests/optee/mock_tee.c |
Implements the RAM-backed TEE stand-in. |
tests/optee/fwtpm_optee_port_tests.c |
Tests key selection, storage, sessions and buffer handling. |
tests/include.am |
Registers port tests and distributes supporting files. |
.gitignore |
Ignores generated test binaries and logs. |
.github/workflows/optee-mock.yml |
Runs real-core tests in standard and sanitizer configurations. |
Review effort: Balanced
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.
Description
The OP-TEE trusted application port from #659 was only exercised on a Jetson Orin. This adds a mock TEE so the port is tested on the host in
make checkand CI. Everything lives undertests/optee.What it adds
tests/optee/tee_internal_api.h,pta_system.h,mock_tee.c- RAM-backed stand-in for the TEE Internal Core API subset the port and wolfCrypt'sWOLFSSL_OPTEEsupport use, with injectable failures (system PTA missing, key object unreadable, storage unavailable)tests/optee/fwtpm_optee_port_tests.c-tests/fwtpm_optee_port.testinmake checkfor every fwTPM configuration; stubs the fwTPM core and covers NV integrity key selection, secure storage access, session to client mapping and command/response buffer handlingtests/optee/optee_core_tests.c,optee_core.mk,user_settings.h- the port with the real fwTPM core and wolfCrypt compiled from source asWOLFSSL_OPTEE, driven through the TA entry points; covers per-session ownership of transient objects and the NV journal in secure storage across TA instances, including a missing PTA and a journal that fails its MAC.github/workflows/optee-mock.yml- runs the core tests, plain and under ASan/UBSan, against a pinned wolfSSL commit on pushes and pull requests that touch the fwTPM, and against wolfSSL master on the nightly triggertests/optee/README.md- how the two suites are built and runTesting
Both suites pass locally, under ASan/UBSan and with clang. Each was checked against deliberate faults in the port and core (no flush on session close, flush of every client, fallback key created over an existing journal, response staging buffer not cleared, short-buffer check after the command runs, gap filled with zeroes, uncached integrity key), and every fault fails at least one test.