From 797f48ace6735436c357e82b11b07019454dc4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 18 Jun 2015 15:45:05 +0200 Subject: [PATCH] Rename ecp_curve_info.size to bit_size --- ChangeLog | 4 +++- include/mbedtls/ecp.h | 6 +++--- programs/test/benchmark.c | 6 +++--- tests/suites/test_suite_ecp.function | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index df3564f32..b9668328b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,7 +22,9 @@ API Changes Migration helpers scripts/rename.pl and include/mbedlts/compat-1.3.h are provided. Full list of renamings in scripts/data_files/rename-1.3-2.0.txt * Renamings of fields inside structures, not covered by the previous list: - cipher_info.key_length -> key_bitlen + mbedtls_cipher_info_t.key_length -> key_bitlen + mbedtls_cipher_context_t.key_length -> key_bitlen + mbedtls_ecp_curve_info.size -> bit_size * Headers are now found in the 'mbedtls' directory (previously 'polarssl'). * The following _init() functions that could return errors have been split into an _init() that returns void and another function that diff --git a/include/mbedtls/ecp.h b/include/mbedtls/ecp.h index 80b4ee385..bac1bd007 100644 --- a/include/mbedtls/ecp.h +++ b/include/mbedtls/ecp.h @@ -84,9 +84,9 @@ typedef enum typedef struct { mbedtls_ecp_group_id grp_id; /*!< Internal identifier */ - uint16_t tls_id; /*!< TLS NamedCurve identifier */ - uint16_t size; /*!< Curve size in bits */ - const char *name; /*!< Human-friendly name */ + uint16_t tls_id; /*!< TLS NamedCurve identifier */ + uint16_t bit_size; /*!< Curve size in bits */ + const char *name; /*!< Human-friendly name */ } mbedtls_ecp_curve_info; /** diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index 67797c64a..81f781348 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -681,7 +681,7 @@ int main( int argc, char *argv[] ) mbedtls_snprintf( title, sizeof( title ), "ECDSA-%s", curve_info->name ); TIME_PUBLIC( title, "sign", - ret = mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->size, + ret = mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->bit_size, tmp, &sig_len, myrand, NULL ) ); mbedtls_ecdsa_free( &ecdsa ); @@ -694,7 +694,7 @@ int main( int argc, char *argv[] ) mbedtls_ecdsa_init( &ecdsa ); if( mbedtls_ecdsa_genkey( &ecdsa, curve_info->grp_id, myrand, NULL ) != 0 || - mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->size, + mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->bit_size, tmp, &sig_len, myrand, NULL ) != 0 ) { mbedtls_exit( 1 ); @@ -704,7 +704,7 @@ int main( int argc, char *argv[] ) mbedtls_snprintf( title, sizeof( title ), "ECDSA-%s", curve_info->name ); TIME_PUBLIC( title, "verify", - ret = mbedtls_ecdsa_read_signature( &ecdsa, buf, curve_info->size, + ret = mbedtls_ecdsa_read_signature( &ecdsa, buf, curve_info->bit_size, tmp, sig_len ) ); mbedtls_ecdsa_free( &ecdsa ); diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index fb68a0fdb..56b8f6194 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -24,7 +24,7 @@ void mbedtls_ecp_curve_info( int id, int tls_id, int size, char *name ) TEST_ASSERT( by_id == by_tls ); TEST_ASSERT( by_id == by_name ); - TEST_ASSERT( by_id->size == size ); + TEST_ASSERT( by_id->bit_size == size ); } /* END_CASE */