Refactor macro-spanning if in asn1write.c

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2022-10-06 18:57:57 +01:00
parent f3b1eaf95d
commit 863b17d0cc

View File

@ -72,9 +72,11 @@ int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start, size_t len
return( 4 );
}
int len_valid = 1;
#if SIZE_MAX > 0xFFFFFFFF
if( len <= 0xFFFFFFFF )
len_valid = ( len <= 0xFFFFFFFF );
#endif
if( len_valid )
{
if( *p - start < 5 )
return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
@ -86,10 +88,10 @@ int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start, size_t len
*--(*p) = 0x84;
return( 5 );
}
#if SIZE_MAX > 0xFFFFFFFF
return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
#endif
else
{
return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
}
}
int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag )