Skip to content

image.c: mldsa: don't discard return value - #856

Open
rizlik wants to merge 1 commit into
wolfSSL:masterfrom
rizlik:mldsa_ret_check
Open

image.c: mldsa: don't discard return value#856
rizlik wants to merge 1 commit into
wolfSSL:masterfrom
rizlik:mldsa_ret_check

Conversation

@rizlik

@rizlik rizlik commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

F-7968

Copilot AI lite review requested due to automatic review settings August 12, 2026 11:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts ML-DSA signature verification in src/image.c to properly handle and propagate error states (avoiding use of an uninitialized key and ensuring return values are not effectively ignored) during wolfCrypt ML-DSA key setup.

Changes:

  • Adds an early return when wc_MlDsaKey_Init() fails (preventing subsequent operations on an uninitialized wc_MlDsaKey).
  • Makes ML-DSA wolfHSM key-ID setup conditional on prior success (ret == 0) after parameter configuration.
  • Simplifies control flow by removing a redundant if (ret == 0) wrapper around wc_MlDsaKey_SetParams().

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/image.c
Comment on lines 820 to 824
if (ret != 0) {
/* Failed to initialize key, nothing to free */
wolfBoot_printf("error: wc_MlDsaKey_Init returned %d\n", ret);
return;
}
@danielinux danielinux assigned rizlik and unassigned danielinux Aug 13, 2026
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.

3 participants