CCM*: Remove nested if

This commit is contained in:
Janos Follath 2018-05-29 11:33:45 +01:00
parent 6b4bd3dcc4
commit 997e85c049

View file

@ -152,14 +152,12 @@ static int ccm_auth_crypt( mbedtls_ccm_context *ctx, int mode, size_t length,
* Check length requirements: SP800-38C A.1
* Additional requirement: a < 2^16 - 2^8 to simplify the code.
* 'length' checked later (when writing it to the first block)
*
* Also, loosen the requirements to enable support for CCM* (IEEE 802.15.4).
*/
if( tag_len < 4 || tag_len > 16 || tag_len % 2 != 0 )
if( tag_len == 2 || tag_len > 16 || tag_len % 2 != 0 )
{
/*
* Loosen the requirements to enable support for CCM* (IEEE 802.15.4)
*/
if( tag_len != 0 )
return( MBEDTLS_ERR_CCM_BAD_INPUT );
return( MBEDTLS_ERR_CCM_BAD_INPUT );
}
/* Also implies q is within bounds */