mirror of
https://github.com/espressif/mbedtls.git
synced 2026-08-11 14:07:47 +00:00
ccm: Fail when calling finish without ccm_starts
Signed-off-by: Minos Galanakis <[email protected]>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user