Repository navigation
Conversation
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 V2 PKA clobbers
RAM[PKA_ECC_SCALAR_MUL_IN_OP_NB_BITS]during the operation, soHAL_PKA_ECCMul_GetResult()recomputing the result length from that slot read zero, copied nothing out, and leftwc_ecc_mulmod_ex2()handing back the caller's own input point - public keys derived from a private key were wrong, so signatures did not verify against them and ECDH mismatched, surfacing as ECIES and PKCS7 KARI failures rather than as an ECC fault;HAL_PKA_ECCMul()now saves the modulus size on the handle as the V2 HAL does, and V1 still reads it from RAM. Separately the V2 PKA draws on the RNG during its init self-check, soSR.INITOKnever asserted from cold and every operation failed withWC_HW_E, whichHAL_PKA_Init()now avoids by bringing the RNG up first. Also fixed:INT_MAXundeclared on an STM32USE_FAST_MATHbuild, andwolfcrypt_testfailing to compile withNO_PKCS7_ENCRYPTED_DATA.Only reachable without
WOLFSSL_HAVE_SP_ECC, since with SP math key generation and ECDH stay in software and never reach the PKA.ZD 22578
Testing
Validated on NUCLEO-U545RE-Q and B-U585I-IOT02A against the NIST P-256 CAVP d -> Q vector and the full
wolfcrypt_test, and regressed on NUCLEO-U385RG-Q (V2 PKA) and STM32L562E-DK (V1 PKA).Checklist