mirror of
https://github.com/espressif/mbedtls.git
synced 2026-08-21 02:39:53 +00:00
ccm_finish: Only reject tag_len missmatch when it has been set.
Signed-off-by: Minos Galanakis <[email protected]>
This commit is contained in:
+5
-2
@@ -488,8 +488,11 @@ int mbedtls_ccm_finish(mbedtls_ccm_context *ctx,
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
if ((tag_len != 0 && (tag_len < 4 || tag_len > 16 || (tag_len & 1) != 0)) ||
|
||||
(tag_len != ctx->tag_len)) {
|
||||
/* 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)) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
if ((ctx->state & CCM_STATE__LENGTHS_SET) && tag_len != ctx->tag_len) {
|
||||
return MBEDTLS_ERR_CCM_BAD_INPUT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user