SE050: create ECDH derive target object for applet 7.2 middleware#10971
Open
LinuxJedi wants to merge 4 commits into
Open
SE050: create ECDH derive target object for applet 7.2 middleware#10971LinuxJedi wants to merge 4 commits into
LinuxJedi wants to merge 4 commits into
Conversation
Middleware built for SE05x applet >= 07_02 (required for SE052) derives the ECDH shared secret with Se05x_API_ECDHGenerateSharedSecret_InObject, which requires TLV[TAG_7] to reference an existing HMACKey object sized exactly to the shared secret; otherwise the applet returns SW 0x6985 (conditions not satisfied). The port never created this object, so ECDH offload failed with WC_HW_E on such builds. Create the derive target as an HMACKey object of the exact secret size before the derive, for both ECC and Curve25519 shared secrets. Read the result back as AES type since sss_se05x_key_store_get_key has no HMAC read case.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes SE050 ECDH offload failures against SE05x applet >= 7.2 middleware by ensuring a correctly-sized derive-target object exists before calling the shared-secret derive APIs.
Changes:
- Allocate the ECDH derive target as an
HMACKeyobject (instead ofBinary) so applet 7.2+ can store the shared secret into an existing object. - Pre-create the derive-target object with the exact shared-secret size (ECC and Curve25519) prior to derivation.
- Read the derived secret back by temporarily treating the object as AES since
sss_key_store_get_key()lacks an HMAC read case.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Align se050_curve25519_shared_secret with the ECC path: set deriveKeyCreated only after sss_key_store_set_key succeeds, so the cleanup path cannot erase or free a derive key object whose handle was never allocated.
Bump SIMULATORS_REF to the simulator commit that supports HMACKey WriteSymmKey and the applet 7.2 ECDH InObject contract, and run the test container with SE050_SIM_STRICT_ECDH=1 so the simulator refuses an ECDH derive whose Tag7 target object was not pre-created. This is the failure mode seen on SE05x applet >= 7.2 hardware and reproduces it in CI against the unfixed port. The pinned simulator commit also consumes the WOLFSSL_EXTRA_CFLAGS build ARG, so the only-key-id matrix leg now really builds with -DWOLFSSL_SE050_ONLY_KEY_ID (previously the ARG was not consumed and the leg silently built the default configuration), and it fixes the simulator to derive the EC public key on private-only key pair import so wc_ecc_use_key_id can read the public part back. Raise the job timeout for cold image rebuilds until the weekend cron refreshes the registry cache for the new ref.
The previous pin abbreviated to the right commit but the full hash was invalid, so the simulator checkout step could never resolve it. Pin the full commit id of the merged simulator change.
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.
Middleware built for SE05x applet >= 07_02 (required for SE052) derives the ECDH shared secret with Se05x_API_ECDHGenerateSharedSecret_InObject, which requires TLV[TAG_7] to reference an existing HMACKey object sized exactly to the shared secret; otherwise the applet returns SW 0x6985 (conditions not satisfied). The port never created this object, so ECDH offload failed with WC_HW_E on such builds.
Create the derive target as an HMACKey object of the exact secret size before the derive, for both ECC and Curve25519 shared secrets. Read the result back as AES type since sss_se05x_key_store_get_key has no HMAC read case.
Fixes zd#22069
Testing
wolfSSL/simulators#9