Support X25519 and X448 public key inspection - #102
Open
dangfan wants to merge 1 commit into
Open
Conversation
Recognize PKCS#11 v3 CKK_EC_MONTGOMERY objects in the listing and attribute-dump tools. Export and render X25519 and X448 public keys from standard raw points or legacy DER-wrapped values, with unit and mock integration coverage. Signed-off-by: Fan DANG <i@dang.fan>
There was a problem hiding this comment.
🟡 Changes recommended
Error propagation and mock mechanism-advertising inconsistencies must be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds X25519/X448 Montgomery public-key inspection, rendering, and RFC 8410 export support.
Changes:
- Recognizes Montgomery key types and curve parameters.
- Builds OpenSSL keys from raw or DER-wrapped public values.
- Adds documentation, unit tests, and mock integration coverage.
File summaries
| File | Description |
|---|---|
tests/unit/test_ec.c |
Tests parameter parsing and key construction. |
tests/mock/mock_pkcs11.c |
Seeds mock Montgomery objects, but incorrectly advertises unsupported key-pair generation. |
tests/Makefile.am |
Registers integration coverage. |
tests/integration/mock_montgomery.sh |
Exercises inspection and export. |
man/p11more.1.md |
Documents rendering support. |
man/p11cat.1.md |
Documents export support. |
lib/pkcs11_pkey.c |
Constructs X25519/X448 public keys. |
lib/pkcs11_od.c |
Names the Montgomery key type. |
lib/pkcs11_more.c |
Renders Montgomery keys, but missing attributes can still yield successful empty output. |
lib/pkcs11_ls.c |
Identifies Montgomery keys. |
lib/pkcs11_ec.c |
Decodes Montgomery curve parameters. |
lib/pkcs11_cat.c |
Exports Montgomery keys, but missing attributes can still yield successful empty output. |
include/pkcs11lib.h |
Declares Montgomery helper APIs. |
docs/MANUAL.md |
Documents inspection and export. |
CHANGELOG.md |
Records Montgomery support. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+493
to
+495
| if(oecparams == NULL || oecpoint == NULL) { | ||
| fprintf(stderr, "Error: object missing attribute(s) CKA_EC_PARAMS and/or CKA_EC_POINT\n"); | ||
| break; |
Comment on lines
+434
to
+438
| oecparams = pkcs11_get_attr_in_attrlist(attrs, CKA_EC_PARAMS); | ||
| oecpoint = pkcs11_get_attr_in_attrlist(attrs, CKA_EC_POINT); | ||
| if(oecparams == NULL || oecpoint == NULL) { | ||
| fprintf(stderr, "Error: object missing attribute(s) CKA_EC_PARAMS and/or CKA_EC_POINT\n"); | ||
| break; |
Comment on lines
883
to
+884
| CKM_EC_EDWARDS_KEY_PAIR_GEN, CKM_EDDSA, | ||
| CKM_EC_MONTGOMERY_KEY_PAIR_GEN, |
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.
Summary
CKK_EC_MONTGOMERYobjects inp11lsandp11odp11catandp11moreTesting
make check TESTS="unit/test_ec integration/mock_montgomery.sh"p11ls,p11od,p11cat, andp11more; the exported SPKI parsed successfully with OpenSSL and preserved the rawCKA_EC_POINTbytesFixes #101