Skip to content

xtest: detect intermediate crypto data in REE shared output buffers - #860

Open
ysbnim wants to merge 3 commits into
OP-TEE:masterfrom
ysbnim:master
Open

ysbnim wants to merge 3 commits into
OP-TEE:masterfrom
ysbnim:master

Conversation

@ysbnim

@ysbnim ysbnim commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

A crypto operation may temporarily write intermediate data to an output buffer backed by REE shared memory. A concurrent normal-world thread can read it before the final result overwrites it.

This series adds three race tests:

  • pkcs11_1031 wraps a known sensitive key with RSA-AES and watches the shared output for target-key bytes.
  • pkcs11_1032 encrypts known plaintext with RSA PKCS#1 v1.5 and watches for plaintext in the encoded output.
  • regression_4025 signs a known digest through the crypt test TA and watches for its RSASSA encoding.

The first two tests cover the PKCS#11 and RSAES fixes in OP-TEE/optee_os#8284. The third guards the existing RSASSA fix in [14a6359a8](https://github.com/OP-TEE/optee_os/
commit/14a6359a8ce48ec8f9fd9e6af801bf97556f1727).

Each test starts an observer thread before one operation, reports the number of hits, and fails if it sees an intermediate value. Detection depends on thread scheduling, so a passing run does not prove that every race is absent.

Wrap a known key through PKCS11 with a shared output buffer. A
concurrent normal-world thread checks whether the target key appears
before wrapping finishes. Fail if plaintext key bytes are observed.

Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com>
Encrypt a known message with PKCS11 C_Encrypt while another thread
observes its shared output. Fail if the PKCS#1 v1.5 encoded plaintext
appears before RSA encryption finishes.

Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com>
Sign a known digest through the crypt test TA with shared output. A
concurrent normal-world thread checks for the PKCS#1 v1.5 encoded
digest before signing finishes.

Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com>
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