ccm: Fail when calling finish without ccm_starts

Signed-off-by: Minos Galanakis <[email protected]>
This commit is contained in:
Minos Galanakis
2026-03-10 22:04:27 +00:00
parent 27069c6be6
commit 32caf3bad0
+4
View File
@@ -480,6 +480,10 @@ int mbedtls_ccm_finish(mbedtls_ccm_context *ctx,
return MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
}
if (!(ctx->state & CCM_STATE__STARTED)) {
return MBEDTLS_ERR_CCM_BAD_INPUT;
}
if (ctx->add_len > 0 && !(ctx->state & CCM_STATE__AUTH_DATA_FINISHED)) {
return MBEDTLS_ERR_CCM_BAD_INPUT;
}