mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-09-04 01:09:59 +00:00
ccm: Re-ordered len checks in mbedtls_ccm_finish.
Signed-off-by: Minos Galanakis <[email protected]>
This commit is contained in:
+4
-4
@@ -484,6 +484,10 @@ int mbedtls_ccm_finish(mbedtls_ccm_context *ctx,
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
if (!(ctx->state & CCM_STATE__LENGTHS_SET)) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
if (ctx->add_len > 0 && !(ctx->state & CCM_STATE__AUTH_DATA_FINISHED)) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
@@ -492,10 +496,6 @@ int mbedtls_ccm_finish(mbedtls_ccm_context *ctx,
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
if (!(ctx->state & CCM_STATE__LENGTHS_SET)) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
if (tag_len != ctx->tag_len) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user