mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-04-03 11:06:14 +02:00
ccm_finish: Updated to only accept lens set by ccm_set_lengths
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
@@ -488,11 +488,11 @@ int mbedtls_ccm_finish(mbedtls_ccm_context *ctx,
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
/* Reject invalid tag lengths and mismatches with negotiated length (if set). */
|
||||
if (tag_len != 0 && (tag_len < 4 || tag_len > 16 || (tag_len & 1) != 0)) {
|
||||
if (!(ctx->state & CCM_STATE__LENGTHS_SET)) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
if ((ctx->state & CCM_STATE__LENGTHS_SET) && tag_len != ctx->tag_len) {
|
||||
|
||||
if (tag_len != ctx->tag_len) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user