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
diff --git a/library/blowfish.c b/library/blowfish.c
index baa3393..767d141 100644
--- a/library/blowfish.c
+++ b/library/blowfish.c
@@ -178,7 +178,7 @@
unsigned int i, j, k;
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 ) )
{
return( MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH );
diff --git a/library/pk.c b/library/pk.c
index 5a83855..b5810b5 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -327,7 +327,7 @@
/*
* 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 )
return( 0 );
diff --git a/library/ssl_ticket.c b/library/ssl_ticket.c
index 3c7dd27..94795f4 100644
--- a/library/ssl_ticket.c
+++ b/library/ssl_ticket.c
@@ -81,7 +81,7 @@
/* With GCM and CCM, same context can encrypt & decrypt */
ret = mbedtls_cipher_setkey( &key->ctx, buf,
- mbedtls_cipher_get_key_size( &key->ctx ),
+ mbedtls_cipher_get_key_bitlen( &key->ctx ),
MBEDTLS_ENCRYPT );
mbedtls_zeroize( buf, sizeof( buf ) );
diff --git a/library/x509_crt.c b/library/x509_crt.c
index bedc6e9..7cb5b44 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -180,7 +180,7 @@
#if defined(MBEDTLS_RSA_C)
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( -1 );
@@ -1438,7 +1438,7 @@
}
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();
/*
diff --git a/library/x509_csr.c b/library/x509_csr.c
index d8ed04a..18ace67 100644
--- a/library/x509_csr.c
+++ b/library/x509_csr.c
@@ -418,7 +418,7 @@
}
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();
return( (int) ( size - n ) );