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 2788f6b668
commit 8a7629fd0f

View File

@ -78,9 +78,11 @@ int mbedtls_asn1_write_len( unsigned char **p, const unsigned char *start, size_
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 );
@ -92,10 +94,10 @@ int mbedtls_asn1_write_len( unsigned char **p, const unsigned char *start, size_
*--(*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, const unsigned char *start, unsigned char tag )