Skip to content

test: add ECDH invalid curve attack regression test (Wycheproof)#816

Open
sahilnxp wants to merge 1 commit into
OP-TEE:masterfrom
sahilnxp:validaete_ecdh_pub_key
Open

test: add ECDH invalid curve attack regression test (Wycheproof)#816
sahilnxp wants to merge 1 commit into
OP-TEE:masterfrom
sahilnxp:validaete_ecdh_pub_key

Conversation

@sahilnxp
Copy link
Copy Markdown
Contributor

@sahilnxp sahilnxp commented Jun 1, 2026

Add regression_4023 to verify that ECDH key derivation rejects peer public keys that do not lie on the negotiated curve (secp256r1). This protects against invalid curve attacks as documented in Wycheproof test vector tcId 335.

The test supplies an off-curve peer public key to TEE_DeriveKey() and expects the TA to panic (TEEC_ERROR_TARGET_DEAD), confirming that the underlying public key validation in OP-TEE core correctly detects and rejects the invalid point before any shared secret is computed.

Also update the ret_orig check in ta_crypt_cmd_derive_key() to accept both TEEC_ORIGIN_TRUSTED_APP and TEEC_ORIGIN_TEE, since a validation failure in the core crypto layer causes TEE_DeriveKey() to panic, resulting in TEEC_ORIGIN_TEE rather than TEEC_ORIGIN_TRUSTED_APP.

Add regression_4023 to verify that ECDH key derivation rejects peer
public keys that do not lie on the negotiated curve (secp256r1).
This protects against invalid curve attacks as documented in
Wycheproof test vector tcId 335.

The test supplies an off-curve peer public key to TEE_DeriveKey()
and expects the TA to panic (TEEC_ERROR_TARGET_DEAD), confirming
that the underlying public key validation in OP-TEE core correctly
detects and rejects the invalid point before any shared secret is
computed.

Also update the ret_orig check in ta_crypt_cmd_derive_key() to
accept both TEEC_ORIGIN_TRUSTED_APP and TEEC_ORIGIN_TEE, since a
validation failure in the core crypto layer causes TEE_DeriveKey()
to panic, resulting in TEEC_ORIGIN_TEE rather than
TEEC_ORIGIN_TRUSTED_APP.

Signed-off-by: Sahil Malhotra <sahil.malhotra@nxp.com>
@sahilnxp
Copy link
Copy Markdown
Contributor Author

sahilnxp commented Jun 1, 2026

Related to OP-TEE/optee_os#7828

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