{"data":{"slug":"discovered-624fbf62faac0bd59c32a661d237e278e7aa3a5234803e8a","title":"NetX Secure Crypto: Adaptor Layer for ECC Implementations","summary":"Implement or stub the NetX secure crypto adaptor layer for ECC (Elliptic Curve Cryptography) by defining required functions such as `HW_SCE_Ecc*ScalarMultiplicationSubAdaptor` and `DomainParam_Brainpool_512r1`, ensuring compatibility with specific hardware engines like RSIP-E50D and RSIP-E51A.","url":"https:\/\/skillshunter.net\/skills\/discovered-624fbf62faac0bd59c32a661d237e278e7aa3a5234803e8a","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-624fbf62faac0bd59c32a661d237e278e7aa3a5234803e8a","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-624fbf62faac0bd59c32a661d237e278e7aa3a5234803e8a.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-624fbf62faac0bd59c32a661d237e278e7aa3a5234803e8a\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before implementing, ensure that the engine-specific headers and adaptors are correctly defined. Use the stub pattern for unsupported engines, and verify that the `DomainParam_Brainpool_512r1` is declared as an array to avoid compilation conflicts. The `FSP_ERR_UNSUPPORTED` return value is required for stubbed engines.","instructions":"---\nname: netx\ndescription: NetX secure crypto (rm_netx_secure_crypto) calling the SCE\/RSIP adaptor layer. Use for undefined-reference or undeclared errors on HW_SCE_Ecc*ScalarMultiplicationSubAdaptor or DomainParam_Brainpool_* in rm_netx_secure_crypto, and for adding a per-engine adaptor stub.\n---\n\n# NetX secure crypto: adaptor layer\n\n## Where the calls come from\n- `ra\/fsp\/src\/rm_netx_secure_crypto\/*_alt_process.c` and `rm_netx_secure_crypto.c` call:\n  - `HW_SCE_Ecc256ScalarMultiplicationSubAdaptor` (2 call sites)\n  - `HW_SCE_Ecc384ScalarMultiplicationSubAdaptor` (1)\n  - `HW_SCE_Ecc512ScalarMultiplicationSubAdaptor` (1)\n  - `&DomainParam_Brainpool_512r1[0]` (ECDH, ECDSA, and the NetX driver)\n- Every engine that builds NetX ECC must define all of these.\n\n## Where they are defined\n- Adaptor: `ra\/fsp\/src\/r_sce\/crypto_procedures\/src\/<engine>\/plainkey\/adaptors\/r_sce_adapt.c`\n- Declaration: `...\/<engine>\/plainkey\/private\/inc\/hw_sce_ra_private.h`\n\n## Per-engine status (512-bit ECC)\n| Engine | Status |\n|---|---|\n| rsip_e50d, rsip_e51a | Real implementation |\n| rsip_e11a, rsip_e31a, sce7, sce9 | Stub (`FSP_ERR_UNSUPPORTED`) added |\n| sce5, sce5b | Stub added. Scalar `DomainParam` changed to array form |\n\n## Stub pattern\n- Same parameter list as the 384-bit adaptor.\n- `FSP_PARAMETER_NOT_USED` on each argument, then `return FSP_ERR_UNSUPPORTED;`.\n- The e11a `HW_SCE_Aes192EncryptDecryptInitSub` is the reference stub.\n- Runtime effect: 512-bit ECDH returns `FSP_ERR_UNSUPPORTED` on stubbed engines.\n\n## Dummy domain parameters\n- Adaptor: `uint32_t const DomainParam_Brainpool_512r1[ECC_DUMMY_DOMAIN_PARAM_SIZE] = {0};`\n- Header: `extern uint32_t const DomainParam_Brainpool_512r1[ECC_DUMMY_DOMAIN_PARAM_SIZE];`\n- Size macro is `(1)`. sce5 and sce5b define it in their headers.\n- Use the array form. `&X[0]` does not compile on a scalar, and a scalar definition conflicts with the array `extern`.\n\n## Gotchas\n- A header may already declare a function with the same signature (sce5b declares `Ecc256` at line 180). Don't add a second copy.\n- Not verified by a build. Generated BSP headers are not in the repo.\n- Related: `psa\/mbedtls-v4-migration-notes\/mbedtls-v3-notes.md` has the full adaptor coverage table for `rm_psa_crypto`.\n\n## Branch FSPRA-5013_Support_ECC_bp512r1_PSA_NetX (status)\n- Goal: Brainpool P-512 (bp512r1) ECDH and ECDSA in `rm_netx_secure_crypto`. Real support only on RSIP-E51A and RSIP-E50D. Other engines use the stubs above.\n- Macros (`inc\/rm_netx_secure_crypto.h`): `P512_CURVE_SIZE_BYTES` = 64. `LARGEST_FORMATTED_ECC_PUBLIC_KEY_WORDS` = 37 on E51A\/E50D, else 32. `LARGEST_CURVE_SIZE_BYTES` follows the same split. `ECC_WRAPPED_KEY_SIZE(bits)` maps curves under 256 bits to the 256-bit wrapped size.\n- Public key format: E11A, E31A, E51A and E50D return a plain X||Y key. SCE7 and SCE9 return a formatted key. Branch on `BSP_FEATURE_RSIP_RSIP_E51A\/E50D_SUPPORTED`.\n- Key generation for P-512 (`rm_netx_secure_crypto.c`) calls `HW_SCE_GenerateEccP512RandomKeyIndexSubAdaptor` on E51A and E50D only.\n- Tests: `!test\/rm_netx_secure_crypto_tests_tg3.c` changed. `!example\/rm_netx_secure_crypto_example.c` added (about 187 lines).\n- History (key commits): \"Disable bp512r1 for NetX sw since library didn't support\", \"Modify ECDH max key size for NetX\", \"Add missing NetX bp512r1 ECDH implement\".\n- Uncommitted in the working tree: `nx_crypto_ecdh_alt_process.c` (not part of this note).\n- Open: the link error for `HW_SCE_Ecc512ScalarMultiplicationSubAdaptor` is covered by the stubs. Check the sce5 and sce5b builds before relying on them.\n","use_cases":["Implementing ECC-based cryptographic operations for NetX on supported hardware engines (RSIP-E50D, RSIP-E51A)","Stubbing ECC functions for unsupported hardware engines (e.g., SCE5, SCE5B) with `FSP_ERR_UNSUPPORTED`","Defining `DomainParam_Brainpool_512r1` as an array to avoid compilation conflicts","Adding per-engine adaptor stubs for NetX secure crypto"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/minhnguyenyf\/skills\/blob\/7213d81500a27f3a96028144f5342ccfe4efbe4a\/netx\/SKILL.md","source_commit":"7213d81500a27f3a96028144f5342ccfe4efbe4a","license":null,"version":null,"listing_approved_at":"2026-11-30","created_at":"2026-11-29T11:12:13.000000Z","updated_at":"2026-11-30T06:52:26.000000Z","seo_title":"NetX Secure Crypto Adaptor Layer Implementation","seo_description":"Implement or stub the NetX secure crypto adaptor layer for ECC, including required functions and domain parameters, ensuring compatibility with supported hardware engines","seo_keywords":["NetX secure crypto","ECC adaptor layer","RSIP-E50D","RSIP-E51A","stub implementation","DomainParam_Brainpool_512r1","FSP_ERR_UNSUPPORTED","NetX ECC"]}}