Skip to content

Check raw pubkey length in wc_ecc_import_x963 before copying to it for KCAPI case.#9988

Open
kareem-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
kareem-wolfssl:zd21356
Open

Check raw pubkey length in wc_ecc_import_x963 before copying to it for KCAPI case.#9988
kareem-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
kareem-wolfssl:zd21356

Conversation

@kareem-wolfssl
Copy link
Contributor

Description

Fixes zd#21356

Testing

Built in tests, provided reproducer

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@kareem-wolfssl kareem-wolfssl self-assigned this Mar 16, 2026
Copilot AI review requested due to automatic review settings March 16, 2026 22:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a bounds check to prevent overrunning key->pubkey_raw when importing an X9.63 public key under the WOLFSSL_KCAPI_ECC build configuration (fix for zd#21356).

Changes:

  • Guard XMEMCPY(key->pubkey_raw, ...) with a length check for the KCAPI ECC case.
  • Return an error when the provided public key blob is larger than the destination buffer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

if (inLen <= (word32)sizeof(key->pubkey_raw))
XMEMCPY(key->pubkey_raw, (byte*)in, inLen);
else
err = BAD_FUNC_ARG;
Comment on lines +10738 to +10741
if (inLen <= (word32)sizeof(key->pubkey_raw))
XMEMCPY(key->pubkey_raw, (byte*)in, inLen);
else
err = BAD_FUNC_ARG;
@JacobBarthelmeh
Copy link
Contributor

Retest this please Jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants