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

Unify error handling #419

Merged
merged 1 commit into from
Aug 30, 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
6 changes: 3 additions & 3 deletions lib/yubihsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ yh_rc yh_send_plain_msg(yh_connector *connector, yh_cmd cmd,
Msg response_msg = {0};

if (data_len > sizeof(msg.st.data)) {
DBG_ERR("Tried to transfer oversized data (%zu > %zu)", data_len,
DBG_ERR("%s (%zu > %zu)", yh_strerror(YHR_BUFFER_TOO_SMALL), data_len,
sizeof(msg.st.data));
return YHR_INVALID_PARAMETERS;
return YHR_BUFFER_TOO_SMALL;
}

msg.st.cmd = cmd;
Expand Down Expand Up @@ -431,7 +431,7 @@ static yh_rc send_encrypted_msg(Scp_ctx *session, yh_cmd cmd,

// Outer command { cmd | cmd_len | sid | encrypted payload | mac }
if (3 + 1 + len + SCP_MAC_LEN > SCP_MSG_BUF_SIZE) {
DBG_ERR("%s: %u", yh_strerror(YHR_BUFFER_TOO_SMALL), 3 + 1 + len + SCP_MAC_LEN);
DBG_ERR("%s (%u > %u)", yh_strerror(YHR_BUFFER_TOO_SMALL), 3 + 1 + len + SCP_MAC_LEN, SCP_MSG_BUF_SIZE);
return YHR_BUFFER_TOO_SMALL;
}

Expand Down
Loading