Rename relevant global symbols from size to bitlen

Just applying rename.pl with this file:

mbedtls_cipher_get_key_size mbedtls_cipher_get_key_bitlen
mbedtls_pk_get_size mbedtls_pk_get_bitlen
MBEDTLS_BLOWFISH_MIN_KEY MBEDTLS_BLOWFISH_MIN_KEY_BITS
MBEDTLS_BLOWFISH_MAX_KEY MBEDTLS_BLOWFISH_MAX_KEY_BITS
This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-18 16:43:38 +02:00
parent fb317c5221
commit 097c7bb05b
11 changed files with 21 additions and 21 deletions

View File

@ -35,8 +35,8 @@
#define MBEDTLS_BLOWFISH_ENCRYPT 1 #define MBEDTLS_BLOWFISH_ENCRYPT 1
#define MBEDTLS_BLOWFISH_DECRYPT 0 #define MBEDTLS_BLOWFISH_DECRYPT 0
#define MBEDTLS_BLOWFISH_MAX_KEY 448 #define MBEDTLS_BLOWFISH_MAX_KEY_BITS 448
#define MBEDTLS_BLOWFISH_MIN_KEY 32 #define MBEDTLS_BLOWFISH_MIN_KEY_BITS 32
#define MBEDTLS_BLOWFISH_ROUNDS 16 /**< Rounds to use. When increasing this value, make sure to extend the initialisation vectors */ #define MBEDTLS_BLOWFISH_ROUNDS 16 /**< Rounds to use. When increasing this value, make sure to extend the initialisation vectors */
#define MBEDTLS_BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */ #define MBEDTLS_BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */

View File

@ -415,7 +415,7 @@ static inline const char *mbedtls_cipher_get_name( const mbedtls_cipher_context_
* MBEDTLS_KEY_LENGTH_NONE if ctx has not been * MBEDTLS_KEY_LENGTH_NONE if ctx has not been
* initialised. * initialised.
*/ */
static inline int mbedtls_cipher_get_key_size( const mbedtls_cipher_context_t *ctx ) static inline int mbedtls_cipher_get_key_bitlen( const mbedtls_cipher_context_t *ctx )
{ {
if( NULL == ctx || NULL == ctx->cipher_info ) if( NULL == ctx || NULL == ctx->cipher_info )
return MBEDTLS_KEY_LENGTH_NONE; return MBEDTLS_KEY_LENGTH_NONE;

View File

@ -709,8 +709,8 @@
#define BLOWFISH_BLOCKSIZE MBEDTLS_BLOWFISH_BLOCKSIZE #define BLOWFISH_BLOCKSIZE MBEDTLS_BLOWFISH_BLOCKSIZE
#define BLOWFISH_DECRYPT MBEDTLS_BLOWFISH_DECRYPT #define BLOWFISH_DECRYPT MBEDTLS_BLOWFISH_DECRYPT
#define BLOWFISH_ENCRYPT MBEDTLS_BLOWFISH_ENCRYPT #define BLOWFISH_ENCRYPT MBEDTLS_BLOWFISH_ENCRYPT
#define BLOWFISH_MAX_KEY MBEDTLS_BLOWFISH_MAX_KEY #define BLOWFISH_MAX_KEY MBEDTLS_BLOWFISH_MAX_KEY_BITS
#define BLOWFISH_MIN_KEY MBEDTLS_BLOWFISH_MIN_KEY #define BLOWFISH_MIN_KEY MBEDTLS_BLOWFISH_MIN_KEY_BITS
#define BLOWFISH_ROUNDS MBEDTLS_BLOWFISH_ROUNDS #define BLOWFISH_ROUNDS MBEDTLS_BLOWFISH_ROUNDS
#define CAMELLIA_DECRYPT MBEDTLS_CAMELLIA_DECRYPT #define CAMELLIA_DECRYPT MBEDTLS_CAMELLIA_DECRYPT
#define CAMELLIA_ENCRYPT MBEDTLS_CAMELLIA_ENCRYPT #define CAMELLIA_ENCRYPT MBEDTLS_CAMELLIA_ENCRYPT
@ -1855,7 +1855,7 @@
#define cipher_get_block_size mbedtls_cipher_get_block_size #define cipher_get_block_size mbedtls_cipher_get_block_size
#define cipher_get_cipher_mode mbedtls_cipher_get_cipher_mode #define cipher_get_cipher_mode mbedtls_cipher_get_cipher_mode
#define cipher_get_iv_size mbedtls_cipher_get_iv_size #define cipher_get_iv_size mbedtls_cipher_get_iv_size
#define cipher_get_key_size mbedtls_cipher_get_key_size #define cipher_get_key_size mbedtls_cipher_get_key_bitlen
#define cipher_get_name mbedtls_cipher_get_name #define cipher_get_name mbedtls_cipher_get_name
#define cipher_get_operation mbedtls_cipher_get_operation #define cipher_get_operation mbedtls_cipher_get_operation
#define cipher_get_type mbedtls_cipher_get_type #define cipher_get_type mbedtls_cipher_get_type
@ -2219,7 +2219,7 @@
#define pk_free mbedtls_pk_free #define pk_free mbedtls_pk_free
#define pk_get_len mbedtls_pk_get_len #define pk_get_len mbedtls_pk_get_len
#define pk_get_name mbedtls_pk_get_name #define pk_get_name mbedtls_pk_get_name
#define pk_get_size mbedtls_pk_get_size #define pk_get_size mbedtls_pk_get_bitlen
#define pk_get_type mbedtls_pk_get_type #define pk_get_type mbedtls_pk_get_type
#define pk_info_from_type mbedtls_pk_info_from_type #define pk_info_from_type mbedtls_pk_info_from_type
#define pk_info_t mbedtls_pk_info_t #define pk_info_t mbedtls_pk_info_t

View File

@ -229,7 +229,7 @@ int mbedtls_pk_setup_rsa_alt( mbedtls_pk_context *ctx, void * key,
* *
* \return Key size in bits, or 0 on error * \return Key size in bits, or 0 on error
*/ */
size_t mbedtls_pk_get_size( const mbedtls_pk_context *ctx ); size_t mbedtls_pk_get_bitlen( const mbedtls_pk_context *ctx );
/** /**
* \brief Get the length in bytes of the underlying key * \brief Get the length in bytes of the underlying key
@ -239,7 +239,7 @@ size_t mbedtls_pk_get_size( const mbedtls_pk_context *ctx );
*/ */
static inline size_t mbedtls_pk_get_len( const mbedtls_pk_context *ctx ) static inline size_t mbedtls_pk_get_len( const mbedtls_pk_context *ctx )
{ {
return( ( mbedtls_pk_get_size( ctx ) + 7 ) / 8 ); return( ( mbedtls_pk_get_bitlen( ctx ) + 7 ) / 8 );
} }
/** /**

View File

@ -178,7 +178,7 @@ int mbedtls_blowfish_setkey( mbedtls_blowfish_context *ctx, const unsigned char
unsigned int i, j, k; unsigned int i, j, k;
uint32_t data, datal, datar; uint32_t data, datal, datar;
if( keybits < MBEDTLS_BLOWFISH_MIN_KEY || keybits > MBEDTLS_BLOWFISH_MAX_KEY || if( keybits < MBEDTLS_BLOWFISH_MIN_KEY_BITS || keybits > MBEDTLS_BLOWFISH_MAX_KEY_BITS ||
( keybits % 8 ) ) ( keybits % 8 ) )
{ {
return( MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH ); return( MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH );

View File

@ -327,7 +327,7 @@ int mbedtls_pk_check_pair( const mbedtls_pk_context *pub, const mbedtls_pk_conte
/* /*
* Get key size in bits * Get key size in bits
*/ */
size_t mbedtls_pk_get_size( const mbedtls_pk_context *ctx ) size_t mbedtls_pk_get_bitlen( const mbedtls_pk_context *ctx )
{ {
if( ctx == NULL || ctx->pk_info == NULL ) if( ctx == NULL || ctx->pk_info == NULL )
return( 0 ); return( 0 );

View File

@ -81,7 +81,7 @@ static int ssl_ticket_gen_key( mbedtls_ssl_ticket_context *ctx,
/* With GCM and CCM, same context can encrypt & decrypt */ /* With GCM and CCM, same context can encrypt & decrypt */
ret = mbedtls_cipher_setkey( &key->ctx, buf, ret = mbedtls_cipher_setkey( &key->ctx, buf,
mbedtls_cipher_get_key_size( &key->ctx ), mbedtls_cipher_get_key_bitlen( &key->ctx ),
MBEDTLS_ENCRYPT ); MBEDTLS_ENCRYPT );
mbedtls_zeroize( buf, sizeof( buf ) ); mbedtls_zeroize( buf, sizeof( buf ) );

View File

@ -180,7 +180,7 @@ static int x509_profile_check_key( const mbedtls_x509_crt_profile *profile,
#if defined(MBEDTLS_RSA_C) #if defined(MBEDTLS_RSA_C)
if( pk_alg == MBEDTLS_PK_RSA || pk_alg == MBEDTLS_PK_RSASSA_PSS ) if( pk_alg == MBEDTLS_PK_RSA || pk_alg == MBEDTLS_PK_RSASSA_PSS )
{ {
if( mbedtls_pk_get_size( pk ) >= profile->rsa_min_bitlen ) if( mbedtls_pk_get_bitlen( pk ) >= profile->rsa_min_bitlen )
return( 0 ); return( 0 );
return( -1 ); return( -1 );
@ -1438,7 +1438,7 @@ int mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,
} }
ret = mbedtls_snprintf( p, n, "\n%s%-" BC "s: %d bits", prefix, key_size_str, ret = mbedtls_snprintf( p, n, "\n%s%-" BC "s: %d bits", prefix, key_size_str,
(int) mbedtls_pk_get_size( &crt->pk ) ); (int) mbedtls_pk_get_bitlen( &crt->pk ) );
SAFE_SNPRINTF(); SAFE_SNPRINTF();
/* /*

View File

@ -418,7 +418,7 @@ int mbedtls_x509_csr_info( char *buf, size_t size, const char *prefix,
} }
ret = mbedtls_snprintf( p, n, "\n%s%-" BC "s: %d bits\n", prefix, key_size_str, ret = mbedtls_snprintf( p, n, "\n%s%-" BC "s: %d bits\n", prefix, key_size_str,
(int) mbedtls_pk_get_size( &csr->pk ) ); (int) mbedtls_pk_get_bitlen( &csr->pk ) );
SAFE_SNPRINTF(); SAFE_SNPRINTF();
return( (int) ( size - n ) ); return( (int) ( size - n ) );

View File

@ -37,8 +37,8 @@ BADCRL_NOT_TRUSTED MBEDTLS_X509_BADCRL_NOT_TRUSTED
BLOWFISH_BLOCKSIZE MBEDTLS_BLOWFISH_BLOCKSIZE BLOWFISH_BLOCKSIZE MBEDTLS_BLOWFISH_BLOCKSIZE
BLOWFISH_DECRYPT MBEDTLS_BLOWFISH_DECRYPT BLOWFISH_DECRYPT MBEDTLS_BLOWFISH_DECRYPT
BLOWFISH_ENCRYPT MBEDTLS_BLOWFISH_ENCRYPT BLOWFISH_ENCRYPT MBEDTLS_BLOWFISH_ENCRYPT
BLOWFISH_MAX_KEY MBEDTLS_BLOWFISH_MAX_KEY BLOWFISH_MAX_KEY MBEDTLS_BLOWFISH_MAX_KEY_BITS
BLOWFISH_MIN_KEY MBEDTLS_BLOWFISH_MIN_KEY BLOWFISH_MIN_KEY MBEDTLS_BLOWFISH_MIN_KEY_BITS
BLOWFISH_ROUNDS MBEDTLS_BLOWFISH_ROUNDS BLOWFISH_ROUNDS MBEDTLS_BLOWFISH_ROUNDS
CAMELLIA_DECRYPT MBEDTLS_CAMELLIA_DECRYPT CAMELLIA_DECRYPT MBEDTLS_CAMELLIA_DECRYPT
CAMELLIA_ENCRYPT MBEDTLS_CAMELLIA_ENCRYPT CAMELLIA_ENCRYPT MBEDTLS_CAMELLIA_ENCRYPT
@ -1390,7 +1390,7 @@ cipher_free_ctx mbedtls_cipher_free_ctx
cipher_get_block_size mbedtls_cipher_get_block_size cipher_get_block_size mbedtls_cipher_get_block_size
cipher_get_cipher_mode mbedtls_cipher_get_cipher_mode cipher_get_cipher_mode mbedtls_cipher_get_cipher_mode
cipher_get_iv_size mbedtls_cipher_get_iv_size cipher_get_iv_size mbedtls_cipher_get_iv_size
cipher_get_key_size mbedtls_cipher_get_key_size cipher_get_key_size mbedtls_cipher_get_key_bitlen
cipher_get_name mbedtls_cipher_get_name cipher_get_name mbedtls_cipher_get_name
cipher_get_operation mbedtls_cipher_get_operation cipher_get_operation mbedtls_cipher_get_operation
cipher_get_type mbedtls_cipher_get_type cipher_get_type mbedtls_cipher_get_type
@ -1752,7 +1752,7 @@ pk_encrypt mbedtls_pk_encrypt
pk_free mbedtls_pk_free pk_free mbedtls_pk_free
pk_get_len mbedtls_pk_get_len pk_get_len mbedtls_pk_get_len
pk_get_name mbedtls_pk_get_name pk_get_name mbedtls_pk_get_name
pk_get_size mbedtls_pk_get_size pk_get_size mbedtls_pk_get_bitlen
pk_get_type mbedtls_pk_get_type pk_get_type mbedtls_pk_get_type
pk_info_from_type mbedtls_pk_info_from_type pk_info_from_type mbedtls_pk_info_from_type
pk_info_t mbedtls_pk_info_t pk_info_t mbedtls_pk_info_t

View File

@ -75,7 +75,7 @@ void pk_utils( int type, int size, int len, char *name )
TEST_ASSERT( (int) mbedtls_pk_get_type( &pk ) == type ); TEST_ASSERT( (int) mbedtls_pk_get_type( &pk ) == type );
TEST_ASSERT( mbedtls_pk_can_do( &pk, type ) ); TEST_ASSERT( mbedtls_pk_can_do( &pk, type ) );
TEST_ASSERT( mbedtls_pk_get_size( &pk ) == (unsigned) size ); TEST_ASSERT( mbedtls_pk_get_bitlen( &pk ) == (unsigned) size );
TEST_ASSERT( mbedtls_pk_get_len( &pk ) == (unsigned) len ); TEST_ASSERT( mbedtls_pk_get_len( &pk ) == (unsigned) len );
TEST_ASSERT( strcmp( mbedtls_pk_get_name( &pk), name ) == 0 ); TEST_ASSERT( strcmp( mbedtls_pk_get_name( &pk), name ) == 0 );
@ -453,7 +453,7 @@ void pk_rsa_alt( )
/* Test administrative functions */ /* Test administrative functions */
TEST_ASSERT( mbedtls_pk_can_do( &alt, MBEDTLS_PK_RSA ) ); TEST_ASSERT( mbedtls_pk_can_do( &alt, MBEDTLS_PK_RSA ) );
TEST_ASSERT( mbedtls_pk_get_size( &alt ) == RSA_KEY_SIZE ); TEST_ASSERT( mbedtls_pk_get_bitlen( &alt ) == RSA_KEY_SIZE );
TEST_ASSERT( mbedtls_pk_get_len( &alt ) == RSA_KEY_LEN ); TEST_ASSERT( mbedtls_pk_get_len( &alt ) == RSA_KEY_LEN );
TEST_ASSERT( mbedtls_pk_get_type( &alt ) == MBEDTLS_PK_RSA_ALT ); TEST_ASSERT( mbedtls_pk_get_type( &alt ) == MBEDTLS_PK_RSA_ALT );
TEST_ASSERT( strcmp( mbedtls_pk_get_name( &alt ), "RSA-alt" ) == 0 ); TEST_ASSERT( strcmp( mbedtls_pk_get_name( &alt ), "RSA-alt" ) == 0 );