Skip to content

Commit

Permalink
suit: platform: Release digest sink on failure
Browse files Browse the repository at this point in the history
Release digest sink if the write API fails.

Ref: NCSDK-28580

Signed-off-by: Tomasz Chyrowicz <[email protected]>
  • Loading branch information
tomchy authored and rlubos committed Aug 8, 2024
1 parent 3c82955 commit 584bbfb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions subsys/suit/platform/src/suit_plat_digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int suit_plat_check_digest(enum suit_cose_alg alg_id, struct zcbor_string *diges
err = digest_sink.write(digest_sink.ctx, (uint8_t *)payload->value, payload->len);
if (err != SUIT_PLAT_SUCCESS) {
LOG_ERR("Failed to write to stream: %d", err);
(void)digest_sink.release(digest_sink.ctx);
return suit_plat_err_to_processor_err_convert(err);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static digest_sink_err_t verify_digest(uint8_t *buf, size_t buf_size, psa_algori
err = digest_sink.write(digest_sink.ctx, buf, buf_size);
if (err != SUIT_PLAT_SUCCESS) {
LOG_ERR("Failed to write to stream: %d", err);
(void)digest_sink.release(digest_sink.ctx);
return err;
}

Expand Down

0 comments on commit 584bbfb

Please sign in to comment.