void mbedtls_sha512_free(mbedtls_sha512_context *ctx) { if (ctx == NULL) { return; } if (ctx->active_ctx == &ctx->hw_ctx) { mbedtls_sha512_hw_free(&ctx->hw_ctx); crypto_sha_release(); } else if (ctx->active_ctx == &ctx->sw_ctx) { mbedtls_sha512_sw_free(&ctx->sw_ctx); } ctx->active_ctx = NULL; }
void mbedtls_sha256_free(mbedtls_sha256_context *ctx) { if (ctx == NULL) { return; } if (ctx->ishw) { mbedtls_sha256_hw_free(&ctx->hw_ctx); crypto_sha_release(); } else { mbedtls_sha256_sw_free(&ctx->sw_ctx); } }