-
Notifications
You must be signed in to change notification settings - Fork 963
fix: wc_SignatureVerify/Generate allow empty messages #10253
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,8 +324,10 @@ int wc_SignatureVerify( | |
| byte hash_data[MAX_DER_DIGEST_SZ]; | ||
| #endif | ||
|
|
||
| /* Check arguments */ | ||
| if (data == NULL || data_len == 0 || | ||
| /* Check arguments. | ||
| * data may be NULL when data_len is 0 (empty message is valid — | ||
| * the hash of an empty string is well-defined). */ | ||
| if ((data == NULL && data_len > 0) || | ||
|
||
| sig == NULL || sig_len == 0 || | ||
| key == NULL || key_len == 0) { | ||
| return BAD_FUNC_ARG; | ||
|
|
@@ -523,8 +525,9 @@ int wc_SignatureGenerate_ex( | |
| byte hash_data[MAX_DER_DIGEST_SZ]; | ||
| #endif | ||
|
|
||
| /* Check arguments */ | ||
| if (data == NULL || data_len == 0 || | ||
| /* Check arguments. | ||
| * data may be NULL when data_len is 0 (signing an empty message). */ | ||
| if ((data == NULL && data_len > 0) || | ||
|
||
| sig == NULL || sig_len == NULL || *sig_len == 0 || | ||
| key == NULL || key_len == 0) { | ||
| return BAD_FUNC_ARG; | ||
|
|
||
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.
These new comments introduce a non-ASCII em dash character (—). This can cause portability/encoding issues for toolchains that assume ASCII-only C sources or have strict source-charset settings. Consider replacing it with an ASCII sequence like '-' or '--' to avoid build problems in constrained environments.