Skip to content
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

Fix ECC verify bug #81

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/wh_server_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static int _HandleEccVerify(whServerContext* ctx, whPacket* packet,
byte* res_pub = (uint8_t*)(res + 1);
word32 max_size = (word32)(WOLFHSM_CFG_COMM_DATA_LEN -
(res_pub - (uint8_t*)packet));
uint16_t pub_size = 0;
uint32_t pub_size = 0;
billphipps marked this conversation as resolved.
Show resolved Hide resolved
int result;

/* init public key */
Expand All @@ -712,11 +712,14 @@ static int _HandleEccVerify(whServerContext* ctx, whPacket* packet,
if ( (ret == 0) &&
(export_pub_key != 0) ) {
/* Export the public key to the result message*/
pub_size = wc_EccPublicKeyToDer(key, (byte*)res_pub,
ret = wc_EccPublicKeyToDer(key, (byte*)res_pub,
max_size, 1);
if (pub_size < 0) {
if (ret < 0) {
/* Problem dumping the public key. Set to 0 length */
pub_size = 0;
} else {
pub_size = ret;
ret = 0;
}
}
}
Expand Down