1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Rename boolean functions to be clearer

This commit is contained in:
Manuel Pégourié-Gonnard
2015-06-02 10:38:50 +01:00
parent 3eb50fa591
commit c730ed3f2d
14 changed files with 57 additions and 57 deletions

View File

@ -507,7 +507,7 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_PADLOCK_ALIGN16)
if( aes_padlock_ace == -1 )
aes_padlock_ace = mbedtls_padlock_supports( MBEDTLS_PADLOCK_ACE );
aes_padlock_ace = mbedtls_padlock_has_support( MBEDTLS_PADLOCK_ACE );
if( aes_padlock_ace )
ctx->rk = RK = MBEDTLS_PADLOCK_ALIGN16( ctx->buf );
@ -516,7 +516,7 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
ctx->rk = RK = ctx->buf;
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
if( mbedtls_aesni_supports( MBEDTLS_AESNI_AES ) )
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) )
return( mbedtls_aesni_setkey_enc( (unsigned char *) ctx->rk, key, keysize ) );
#endif
@ -608,7 +608,7 @@ int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_PADLOCK_ALIGN16)
if( aes_padlock_ace == -1 )
aes_padlock_ace = mbedtls_padlock_supports( MBEDTLS_PADLOCK_ACE );
aes_padlock_ace = mbedtls_padlock_has_support( MBEDTLS_PADLOCK_ACE );
if( aes_padlock_ace )
ctx->rk = RK = MBEDTLS_PADLOCK_ALIGN16( ctx->buf );
@ -623,7 +623,7 @@ int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
ctx->nr = cty.nr;
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
if( mbedtls_aesni_supports( MBEDTLS_AESNI_AES ) )
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) )
{
mbedtls_aesni_inverse_key( (unsigned char *) ctx->rk,
(const unsigned char *) cty.rk, ctx->nr );
@ -830,7 +830,7 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
unsigned char output[16] )
{
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
if( mbedtls_aesni_supports( MBEDTLS_AESNI_AES ) )
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) )
return( mbedtls_aesni_crypt_ecb( ctx, mode, input, output ) );
#endif

View File

@ -46,7 +46,7 @@
/*
* AES-NI support detection routine
*/
int mbedtls_aesni_supports( unsigned int what )
int mbedtls_aesni_has_support( unsigned int what )
{
static int done = 0;
static unsigned int c = 0;

View File

@ -126,7 +126,7 @@ static int gcm_gen_table( mbedtls_gcm_context *ctx )
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
/* With CLMUL support, we need only h, not the rest of the table */
if( mbedtls_aesni_supports( MBEDTLS_AESNI_CLMUL ) )
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_CLMUL ) )
return( 0 );
#endif
@ -216,7 +216,7 @@ static void gcm_mult( mbedtls_gcm_context *ctx, const unsigned char x[16],
uint64_t zh, zl;
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
if( mbedtls_aesni_supports( MBEDTLS_AESNI_CLMUL ) ) {
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_CLMUL ) ) {
unsigned char h[16];
PUT_UINT32_BE( ctx->HH[8] >> 32, h, 0 );

View File

@ -47,7 +47,7 @@
/*
* PadLock detection routine
*/
int mbedtls_padlock_supports( int feature )
int mbedtls_padlock_has_support( int feature )
{
static int flags = -1;
int ebx = 0, edx = 0;

View File

@ -962,7 +962,7 @@ static int x509_check_time( const mbedtls_x509_time *before, const mbedtls_x509_
return( 0 );
}
int mbedtls_x509_time_expired( const mbedtls_x509_time *to )
int mbedtls_x509_time_is_past( const mbedtls_x509_time *to )
{
mbedtls_x509_time now;
@ -972,7 +972,7 @@ int mbedtls_x509_time_expired( const mbedtls_x509_time *to )
return( x509_check_time( &now, to ) );
}
int mbedtls_x509_time_future( const mbedtls_x509_time *from )
int mbedtls_x509_time_is_future( const mbedtls_x509_time *from )
{
mbedtls_x509_time now;
@ -984,13 +984,13 @@ int mbedtls_x509_time_future( const mbedtls_x509_time *from )
#else /* MBEDTLS_HAVE_TIME */
int mbedtls_x509_time_expired( const mbedtls_x509_time *to )
int mbedtls_x509_time_is_past( const mbedtls_x509_time *to )
{
((void) to);
return( 0 );
}
int mbedtls_x509_time_future( const mbedtls_x509_time *from )
int mbedtls_x509_time_is_future( const mbedtls_x509_time *from )
{
((void) from);
return( 0 );

View File

@ -1479,7 +1479,7 @@ int mbedtls_x509_crt_check_extended_key_usage( const mbedtls_x509_crt *crt,
/*
* Return 1 if the certificate is revoked, or 0 otherwise.
*/
int mbedtls_x509_crt_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl )
int mbedtls_x509_crt_is_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl )
{
const mbedtls_x509_crl_entry *cur = &crl->entry;
@ -1488,7 +1488,7 @@ int mbedtls_x509_crt_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_cr
if( crt->serial.len == cur->serial.len &&
memcmp( crt->serial.p, cur->serial.p, crt->serial.len ) == 0 )
{
if( mbedtls_x509_time_expired( &cur->revocation_date ) )
if( mbedtls_x509_time_is_past( &cur->revocation_date ) )
return( 1 );
}
@ -1565,16 +1565,16 @@ static int x509_crt_verifycrl( mbedtls_x509_crt *crt, mbedtls_x509_crt *ca,
/*
* Check for validity of CRL (Do not drop out)
*/
if( mbedtls_x509_time_expired( &crl_list->next_update ) )
if( mbedtls_x509_time_is_past( &crl_list->next_update ) )
flags |= MBEDTLS_X509_BADCRL_EXPIRED;
if( mbedtls_x509_time_future( &crl_list->this_update ) )
if( mbedtls_x509_time_is_future( &crl_list->this_update ) )
flags |= MBEDTLS_X509_BADCRL_FUTURE;
/*
* Check if certificate is revoked
*/
if( mbedtls_x509_crt_revoked( crt, crl_list ) )
if( mbedtls_x509_crt_is_revoked( crt, crl_list ) )
{
flags |= MBEDTLS_X509_BADCERT_REVOKED;
break;
@ -1774,10 +1774,10 @@ static int x509_crt_verify_top(
unsigned char hash[MBEDTLS_MD_MAX_SIZE];
const mbedtls_md_info_t *md_info;
if( mbedtls_x509_time_expired( &child->valid_to ) )
if( mbedtls_x509_time_is_past( &child->valid_to ) )
*flags |= MBEDTLS_X509_BADCERT_EXPIRED;
if( mbedtls_x509_time_future( &child->valid_from ) )
if( mbedtls_x509_time_is_future( &child->valid_from ) )
*flags |= MBEDTLS_X509_BADCERT_FUTURE;
/*
@ -1851,10 +1851,10 @@ static int x509_crt_verify_top(
((void) ca_crl);
#endif
if( mbedtls_x509_time_expired( &trust_ca->valid_to ) )
if( mbedtls_x509_time_is_past( &trust_ca->valid_to ) )
ca_flags |= MBEDTLS_X509_BADCERT_EXPIRED;
if( mbedtls_x509_time_future( &trust_ca->valid_from ) )
if( mbedtls_x509_time_is_future( &trust_ca->valid_from ) )
ca_flags |= MBEDTLS_X509_BADCERT_FUTURE;
if( NULL != f_vrfy )
@ -1898,10 +1898,10 @@ static int x509_crt_verify_child(
return( MBEDTLS_ERR_X509_CERT_VERIFY_FAILED );
}
if( mbedtls_x509_time_expired( &child->valid_to ) )
if( mbedtls_x509_time_is_past( &child->valid_to ) )
*flags |= MBEDTLS_X509_BADCERT_EXPIRED;
if( mbedtls_x509_time_future( &child->valid_from ) )
if( mbedtls_x509_time_is_future( &child->valid_from ) )
*flags |= MBEDTLS_X509_BADCERT_FUTURE;
md_info = mbedtls_md_info_from_type( child->sig_md );