Skip to content

OpenSSL compat with ML-DSA#10962

Open
kojo1 wants to merge 4 commits into
wolfSSL:masterfrom
kojo1:oss_mldsa
Open

OpenSSL compat with ML-DSA#10962
kojo1 wants to merge 4 commits into
wolfSSL:masterfrom
kojo1:oss_mldsa

Conversation

@kojo1

@kojo1 kojo1 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

wolfSSL_PEM_read_bio_PrivateKey
wolfSSL_PEM_read_PrivateKey
wolfSSL_d2i_PrivateKey, wolfSSL_d2i_PublicKey
wolfSSL_X509_sign
wolfSSL_X509_REQ_sign
wolfSSL_X509_set_pubkey

Fixes zd#22151

Testing

Added test_wolfSSL_PEM_PrivateKey_mldsa
Added ML-DSA cases in test_wolfSSL_X509_set_pubkey

Checklist

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

@Frauschi Frauschi 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.

🐺 Skoll Code Review

Overall recommendation: APPROVE
Findings: 4 total — 3 posted, 2 skipped

Posted findings

  • [High] ML-DSA private key decode in X509 sign/set_pubkey missing PRIVATE_KEY_UNLOCK bracket (fails under FIPS)src/x509.c:12827, src/x509.c:16508
  • [Medium] WC_MAX_X509_GEN increase puts 20 KB on the stack in wolfSSL_X509_REQ_sign for all key typessrc/x509.c:12953-12962, 16922-16923
  • [Medium] wolfSSL_X509_REQ_sign changes lack ML-DSA test coveragesrc/x509.c:16918-16950
Skipped findings
  • [Low] fnames[] can become a zero-length array if all ML-DSA levels are disabled
  • [Medium] WC_MAX_X509_GEN increase puts 20 KB on the stack in wolfSSL_X509_REQ_sign for all key types

Review generated by Skoll via Claude/Codex

Comment thread src/x509.c
@@ -16727,8 +16919,8 @@ int wolfSSL_X509_REQ_sign(WOLFSSL_X509 *req, WOLFSSL_EVP_PKEY *pkey,
const WOLFSSL_EVP_MD *md)

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.

🟡 [Medium] wolfSSL_X509_REQ_sign changes lack ML-DSA test coverage
💡 SUGGEST test

The PR modifies wolfSSL_X509_REQ_sign (buffer sizing) and the wolfSSL_X509_resign_cert ML-DSA signing path that it shares with wolfSSL_X509_sign. The new tests exercise wolfSSL_X509_sign (in test_wolfSSL_X509_set_pubkey) and PEM/d2i loading, but there is no test that signs a certificate REQUEST with an ML-DSA key. A grep of tests/api/test_x509.c (which holds the REQ_sign tests) shows no ML-DSA/dilithium references. The REQ path has its own buffer-declaration mechanism (WC_DECLARE_VAR stack vs. XMALLOC heap) and argument ordering, so it is worth covering separately.

Suggestion: Add a test that builds an X509_REQ, calls wolfSSL_X509_set_pubkey/X509_REQ_sign with an ML-DSA key, and verifies the resulting request.

@kojo1

kojo1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

lack ML-DSA test coverage

Add ML-DSA test coverage for X509_REQ_sign

missing PRIVATE_KEY_UNLOCK bracket

PRIVATE_KEY_UNLOCK to X509 sign/set_pubkey

WC_MAX_X509_GEN increase puts 20 KB on the stack

Dynamic buff size based on expected cert size

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.

2 participants