-
Notifications
You must be signed in to change notification settings - Fork 918
Add PKCS7 ECC raw sign callback support #9656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
🛟 Devin Lifeguard found 2 likely issues in this PR
@jackctj117 |
dgarske
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrecognized macros used:
HAVE_PKCS7_ECC_RAW_SIGN_CALLBACK
add well-formed but unknown macros to .wolfssl_known_macro_extras at top of source tree.
tests/api/test_pkcs7.c
Outdated
| #endif | ||
|
|
||
| #if defined(HAVE_PKCS7) && defined(HAVE_PKCS7_ECC_RAW_SIGN_CALLBACK) && \ | ||
| defined(HAVE_ECC) && defined(NO_RSA) && !defined(NO_SHA256) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need the NO_RSA check here.
tests/api/test_pkcs7.c:457:12: error: unused function 'eccSignRawDigestCb' [-Werror,-Wunused-function]
457 | static int eccSignRawDigestCb(PKCS7* pkcs7, byte* digest, word32 digestSz,
| ^~~~~~~~~~~~~~~~~~
1 error generated.
CC tests/api/unit_test-test_ossl_sk.o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the code looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for ECC raw digest signing callbacks in PKCS7 operations, mirroring the existing RSA callback functionality. The implementation allows users to provide custom ECC signing logic, which is useful for hardware-backed or alternative signing implementations.
Changes:
- Added ECC raw digest signing callback infrastructure (typedef, struct member, and API function)
- Modified PKCS7 signature building logic to invoke the ECC callback when configured
- Added comprehensive test coverage with example callback implementation
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wolfssl/wolfcrypt/pkcs7.h | Added ECC callback typedef, struct member, and API declaration |
| wolfcrypt/src/pkcs7.c | Implemented callback invocation in signing logic and setter function |
| tests/api/test_pkcs7.c | Added example callback and test case for ECC signing |
| .wolfssl_known_macro_extras | Added HAVE_PKCS7_ECC_RAW_SIGN_CALLBACK macro definition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #if defined(HAVE_PKCS7_ECC_RAW_SIGN_CALLBACK) && defined(HAVE_ECC) | ||
| CallbackEccSignRawDigest eccSignRawDigestCb; | ||
| #endif |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new struct member eccSignRawDigestCb should be added at the end of the wc_PKCS7 struct, after the aesKeyWrapUnwrapCb member (around line 389), not here. The comment at line 391 states "!! NEW DATA MEMBERS MUST BE ADDED AT END !!" to maintain backwards compatibility. Placing it in the middle of the struct could break ABI compatibility with existing code.
This pull request adds support for registering and using a user-defined callback for ECC raw digest signing in PKCS7 operations, similar to existing RSA support. The changes include new callback types, struct members, API functions, and corresponding test coverage.
ECC Raw Digest Signing Callback Support:
CallbackEccSignRawDigestfor ECC raw digest signing, and a corresponding struct membereccSignRawDigestCbtowc_PKCS7to allow user-supplied signing logic. [1] [2]wc_PKCS7_SetEccSignRawDigestCbto register the ECC signing callback with a PKCS7 context. [1] [2]Testing Enhancements:
eccSignRawDigestCb) and corresponding test logic intest_pkcs7.cto verify the callback mechanism when ECC is enabled and RSA is disabled. [1] [2]