[protocol] Convert key_rotation to use the new compact error format - #290
[protocol] Convert key_rotation to use the new compact error format#290esnguyen wants to merge 1 commit into
Conversation
Signed-off-by: Ellis Sarza-Nguyen <sarzanguyen@google.com>
| command, 0, rlen); | ||
| return KEY_ROTATION_ERR_INVALID_RESPONSE_SIZE; | ||
| return LIBHOTH_ERR_CONSTRUCT(HOTH_CTX_CMD_EXEC, HOTH_HOST_SPACE_LIBHOTH, | ||
| LIBHOTH_ERR_FAIL); |
There was a problem hiding this comment.
Can we add another HOTH_RES_INVALID_RESPONSE_SIZE and return that here? There is a HOTH_RES_RESPONSE_TOO_BIG but it is not generic enough. The response could be smaller than expected
| "bytes, got %zu\n", | ||
| sizeof(*record_version), rlen); | ||
| return KEY_ROTATION_ERR_INVALID_RESPONSE_SIZE; | ||
| return LIBHOTH_ERR_CONSTRUCT(HOTH_CTX_CMD_EXEC, HOTH_HOST_SPACE_LIBHOTH, |
There was a problem hiding this comment.
Can we add another HOTH_RES_INVALID_RESPONSE_SIZE and return that here? There is a HOTH_RES_RESPONSE_TOO_BIG but it is not generic enough. The response could be smaller than expected
| "bytes, got %zu\n", | ||
| sizeof(*record_status), rlen); | ||
| return KEY_ROTATION_ERR_INVALID_RESPONSE_SIZE; | ||
| return LIBHOTH_ERR_CONSTRUCT(HOTH_CTX_CMD_EXEC, HOTH_HOST_SPACE_LIBHOTH, |
There was a problem hiding this comment.
Same as above, HOTH_RES_INVALID_RESPONSE_SIZE
| sizeof(*payload_status), rlen); | ||
| return KEY_ROTATION_ERR_INVALID_RESPONSE_SIZE; | ||
| return LIBHOTH_ERR_CONSTRUCT(HOTH_CTX_CMD_EXEC, HOTH_HOST_SPACE_LIBHOTH, | ||
| LIBHOTH_ERR_FAIL); |
There was a problem hiding this comment.
Same as above, HOTH_RES_INVALID_RESPONSE_SIZE
| if (init_err != HOTH_SUCCESS) { | ||
| fprintf(stderr, "Failed to initiate key rotation.\n"); | ||
| return KEY_ROTATION_INITIATE_FAIL; | ||
| return init_err; |
There was a problem hiding this comment.
It would make sense to add either KEY_ROTATION_INITIATE_FAIL or generic HTOOL_CMD_INITIATE_FAIL and return that here. Generic one can be reused for payload update as well
| if (commit_err != HOTH_SUCCESS) { | ||
| fprintf(stderr, "Failed to commit key rotation.\n"); | ||
| return KEY_ROTATION_COMMIT_FAIL; | ||
| return commit_err; |
There was a problem hiding this comment.
Same as initiate fail, could add commit fail
No description provided.