diff --git a/include/mbedtls/pk_internal.h b/include/mbedtls/pk_internal.h index ce9198479..f2e0a772b 100644 --- a/include/mbedtls/pk_internal.h +++ b/include/mbedtls/pk_internal.h @@ -42,7 +42,7 @@ struct mbedtls_pk_info_t const char *name; /** Get key size in bits */ - size_t (*get_size)( const void * ); + size_t (*get_bitlen)( const void * ); /** Tell if the context implements this type (e.g. ECKEY can do ECDSA) */ int (*can_do)( mbedtls_pk_type_t type ); diff --git a/include/mbedtls/ssl_internal.h b/include/mbedtls/ssl_internal.h index 391ce5bb8..f9b00170b 100644 --- a/include/mbedtls/ssl_internal.h +++ b/include/mbedtls/ssl_internal.h @@ -265,7 +265,7 @@ struct mbedtls_ssl_transform */ const mbedtls_ssl_ciphersuite_t *ciphersuite_info; /*!< Chosen cipersuite_info */ - unsigned int keylen; /*!< symmetric key length */ + unsigned int keylen; /*!< symmetric key length (bytes) */ size_t minlen; /*!< min. ciphertext length */ size_t ivlen; /*!< IV length */ size_t fixed_ivlen; /*!< Fixed part of IV (AEAD) */ diff --git a/library/pk.c b/library/pk.c index 464243e2e..5a838557e 100644 --- a/library/pk.c +++ b/library/pk.c @@ -332,7 +332,7 @@ size_t mbedtls_pk_get_size( const mbedtls_pk_context *ctx ) if( ctx == NULL || ctx->pk_info == NULL ) return( 0 ); - return( ctx->pk_info->get_size( ctx->pk_ctx ) ); + return( ctx->pk_info->get_bitlen( ctx->pk_ctx ) ); } /* diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 7012b127c..8e584f430 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -64,7 +64,7 @@ static int rsa_can_do( mbedtls_pk_type_t type ) type == MBEDTLS_PK_RSASSA_PSS ); } -static size_t rsa_get_size( const void *ctx ) +static size_t rsa_get_bitlen( const void *ctx ) { return( 8 * ((const mbedtls_rsa_context *) ctx)->len ); } @@ -164,7 +164,7 @@ static void rsa_debug( const void *ctx, mbedtls_pk_debug_item *items ) const mbedtls_pk_info_t mbedtls_rsa_info = { MBEDTLS_PK_RSA, "RSA", - rsa_get_size, + rsa_get_bitlen, rsa_can_do, rsa_verify_wrap, rsa_sign_wrap, @@ -188,7 +188,7 @@ static int eckey_can_do( mbedtls_pk_type_t type ) type == MBEDTLS_PK_ECDSA ); } -static size_t eckey_get_size( const void *ctx ) +static size_t eckey_get_bitlen( const void *ctx ) { return( ((mbedtls_ecp_keypair *) ctx)->grp.pbits ); } @@ -274,7 +274,7 @@ static void eckey_debug( const void *ctx, mbedtls_pk_debug_item *items ) const mbedtls_pk_info_t mbedtls_eckey_info = { MBEDTLS_PK_ECKEY, "EC", - eckey_get_size, + eckey_get_bitlen, eckey_can_do, #if defined(MBEDTLS_ECDSA_C) eckey_verify_wrap, @@ -303,7 +303,7 @@ static int eckeydh_can_do( mbedtls_pk_type_t type ) const mbedtls_pk_info_t mbedtls_eckeydh_info = { MBEDTLS_PK_ECKEY_DH, "EC_DH", - eckey_get_size, /* Same underlying key structure */ + eckey_get_bitlen, /* Same underlying key structure */ eckeydh_can_do, NULL, NULL, @@ -366,7 +366,7 @@ static void ecdsa_free_wrap( void *ctx ) const mbedtls_pk_info_t mbedtls_ecdsa_info = { MBEDTLS_PK_ECDSA, "ECDSA", - eckey_get_size, /* Compatible key structures */ + eckey_get_bitlen, /* Compatible key structures */ ecdsa_can_do, ecdsa_verify_wrap, ecdsa_sign_wrap, @@ -389,7 +389,7 @@ static int rsa_alt_can_do( mbedtls_pk_type_t type ) return( type == MBEDTLS_PK_RSA ); } -static size_t rsa_alt_get_size( const void *ctx ) +static size_t rsa_alt_get_bitlen( const void *ctx ) { const mbedtls_rsa_alt_context *rsa_alt = (const mbedtls_rsa_alt_context *) ctx; @@ -434,7 +434,7 @@ static int rsa_alt_check_pair( const void *pub, const void *prv ) size_t sig_len = 0; int ret; - if( rsa_alt_get_size( prv ) != rsa_get_size( pub ) ) + if( rsa_alt_get_bitlen( prv ) != rsa_get_bitlen( pub ) ) return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED ); memset( hash, 0x2a, sizeof( hash ) ); @@ -475,7 +475,7 @@ static void rsa_alt_free_wrap( void *ctx ) const mbedtls_pk_info_t mbedtls_rsa_alt_info = { MBEDTLS_PK_RSA_ALT, "RSA-alt", - rsa_alt_get_size, + rsa_alt_get_bitlen, rsa_alt_can_do, NULL, rsa_alt_sign_wrap,