Refactor macro-spanning if in asn1write.c
@@ -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
+ else
+ {
return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
-#endif
+ }
}
int mbedtls_asn1_write_tag( unsigned char **p, const unsigned char *start, unsigned char tag )
