Skip to content

Ed448: check for public key presence on export#10656

Open
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-4427
Open

Ed448: check for public key presence on export#10656
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-4427

Conversation

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor

Description

Ed448: check for public key presence on export

Return PUBLIC_KEY_E for wc_ed25519_export_key if public key is not present.
Return PUBLIC_KEY_E for wc_ed448_export_key if public key is not present.
Rename several inLen parameters to outLen for consistency.

Fix F-4427

Testing

How did you test?

Checklist

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

Return PUBLIC_KEY_E for wc_ed25519_export_key if public key is not
present.
Return PUBLIC_KEY_E for wc_ed448_export_key if public key is not
present.
Rename several inLen parameters to outLen for consistency.

Fix F-4427
@holtrop-wolfssl holtrop-wolfssl self-assigned this Jun 10, 2026
Copilot AI review requested due to automatic review settings June 10, 2026 19:12
Comment thread doc/dox_comments/header_files/asn_public.h

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@holtrop-wolfssl holtrop-wolfssl added the For This Release Release version 5.9.2 label Jun 11, 2026
@dgarske dgarske requested a review from Copilot June 11, 2026 20:55

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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment on lines 2775 to +2776
int wc_Ed25519PublicKeyToDer(const ed25519_key* key, byte* output,
int inLen);
word32 outLen);
Comment thread tests/api/test_ed448.c
Comment on lines 501 to +503
ExpectIntEQ(wc_ed448_init(&key), 0);
ExpectIntEQ(wc_Ed448PublicKeyToDer(&key, derBuf, 0, 0),
WC_NO_ERR_TRACE(BUFFER_E));
WC_NO_ERR_TRACE(PUBLIC_KEY_E));
Comment thread wolfcrypt/src/ed448.c
Comment on lines +1133 to +1135
if ((ret == 0) && (!key->pubKeySet)) {
ret = PUBLIC_KEY_E;
}

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Skoll Code Review

Scan type: reviewOverall recommendation: COMMENT
Findings: 2 total — 2 posted, 0 skipped
1 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Medium] New PUBLIC_KEY_E return value not documented for wc_ed448_export_publicwolfcrypt/src/ed448.c:1109-1143, doc/dox_comments/header_files/ed448.h:663-667
  • [Low] Public-API semantics change to wc_ed25519_export_key (private-only keys now error)wolfcrypt/src/ed25519.c:1523-1537

Review generated by Skoll

Comment thread wolfcrypt/src/ed25519.c
}

return ret;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔵 [Low] Public-API semantics change to wc_ed25519_export_key (private-only keys now error)

wc_ed25519_export_key() previously deliberately swallowed PUBLIC_KEY_E from the public-part export (if (ret == WC_NO_ERR_TRACE(PUBLIC_KEY_E)) ret = 0; /* ignore no public key */). This PR removes that and now propagates the error, so a caller exporting a key that has only the private part set (e.g. imported via wc_ed25519_import_private_only) will now receive PUBLIC_KEY_E instead of success. This is the intended behavior of the fix (it makes Ed25519 consistent with Ed448) and all in-tree callers are unaffected: the only library callers are in src/pk.c (wc_ed25519_export_key at line 5320, wc_ed448_export_key at 5828), both invoked right after wc_ed*_make_key, which always sets the public key. Flagging only so the public-API behavior change and its blast radius are recorded; the doxygen for wc_ed25519_export_key/wc_ed448_export_key does not mention the PUBLIC_KEY_E return, which downstream/external callers may want documented.

Fix: Intentional and well-tested (new ed25519/ed448 no-pub export tests added); no code change required. Consider noting the new PUBLIC_KEY_E return in the export_key doxygen for completeness.

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.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants