Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions src/rp2_common/pico_mbedtls/pico_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ void mbedtls_sha256_init(__unused mbedtls_sha256_context *ctx) {
}

void mbedtls_sha256_free(__unused mbedtls_sha256_context *ctx) {
if (ctx->locked) {
pico_sha256_unlock(ctx);
}
}

int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224) {
Expand Down
10 changes: 10 additions & 0 deletions src/rp2_common/pico_sha256/include/pico/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ typedef struct pico_sha256_state {
size_t total_data_size;
} pico_sha256_state_t;

/*! \brief Release the internal lock on the SHA256 hardware
* \ingroup pico_sha256
*
* Release the internal lock on the hardware.
* Fails if the internal lock was not claimed.
*
* @param state A pointer to a pico_sha256_state_t instance
*/
void __weak pico_sha256_unlock(pico_sha256_state_t *state);

/*! \brief Start a SHA-256 calculation returning immediately with an error if the SHA-256 hardware is not available
* \ingroup pico_sha256
*
Expand Down