From afdc1b5cbd357eda6b38a118b4749ab6b9d80e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 9 May 2019 11:24:11 +0200 Subject: [PATCH] Consistently use the name tinycrypt over uecc We called in tinycrypt in the file names, but uecc in config.h, all.sh and other places, which could be confusing. Just use tinycrypt everywhere because that's the name of the project and repo where we took the files. The changes were made using the following commands (with GNU sed and zsh): sed -i 's/uecc/tinycrypt/g' **/*.[ch] tests/scripts/all.sh sed -i 's/MBEDTLS_USE_UECC/MBEDTLS_USE_TINYCRYPT/g' **/*.[ch] tests/scripts/all.sh scripts/config.pl --- include/mbedtls/check_config.h | 4 ++-- include/mbedtls/config.h | 4 ++-- include/tinycrypt/ecc.h | 4 ++-- include/tinycrypt/ecc_dh.h | 4 ++-- include/tinycrypt/ecc_dsa.h | 4 ++-- library/version_features.c | 6 +++--- programs/ssl/query_config.c | 8 ++++---- scripts/config.pl | 2 +- tests/scripts/all.sh | 18 +++++++++--------- tinycrypt/ecc.c | 6 +++--- tinycrypt/ecc_dh.c | 6 +++--- tinycrypt/ecc_dsa.c | 6 +++--- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index e73beac8d..43f68de55 100644 --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h @@ -87,8 +87,8 @@ #error "MBEDTLS_CMAC_C defined, but not all prerequisites" #endif -#if defined(MBEDTLS_USE_UECC) && defined(MBEDTLS_NO_64BIT_MULTIPLICATION) -#error "MBEDTLS_USE_UECC defined, but it cannot be defined with MBEDTLS_NO_64BIT_MULTIPLICATION" +#if defined(MBEDTLS_USE_TINYCRYPT) && defined(MBEDTLS_NO_64BIT_MULTIPLICATION) +#error "MBEDTLS_USE_TINYCRYPT defined, but it cannot be defined with MBEDTLS_NO_64BIT_MULTIPLICATION" #endif #if defined(MBEDTLS_NIST_KW_C) && \ diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index 4d82f629d..aefca9cf4 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -2255,7 +2255,7 @@ #define MBEDTLS_ECP_C /** - * \def MBEDTLS_USE_UECC + * \def MBEDTLS_USE_TINYCRYPT * * Enable the tinycrypt ECC library. * @@ -2266,7 +2266,7 @@ * This module provides alternative ECC handling functions replacing * native MBEDTLS ECP module. */ -//#define MBEDTLS_USE_UECC +//#define MBEDTLS_USE_TINYCRYPT /** * \def MBEDTLS_ENTROPY_C diff --git a/include/tinycrypt/ecc.h b/include/tinycrypt/ecc.h index ede754448..37a7ef1af 100644 --- a/include/tinycrypt/ecc.h +++ b/include/tinycrypt/ecc.h @@ -68,7 +68,7 @@ * */ -#if defined(MBEDTLS_USE_UECC) +#if defined(MBEDTLS_USE_TINYCRYPT) #ifndef __TC_UECC_H__ #define __TC_UECC_H__ @@ -544,4 +544,4 @@ void uECC_vli_bytesToNative(unsigned int *native, const uint8_t *bytes, #endif #endif /* __TC_UECC_H__ */ -#endif /* MBEDTLS_USE_UECC */ +#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/include/tinycrypt/ecc_dh.h b/include/tinycrypt/ecc_dh.h index 18a4fd269..c680a77e6 100644 --- a/include/tinycrypt/ecc_dh.h +++ b/include/tinycrypt/ecc_dh.h @@ -66,7 +66,7 @@ * Security: The curve NIST p-256 provides approximately 128 bits of security. */ -#if defined(MBEDTLS_USE_UECC) +#if defined(MBEDTLS_USE_TINYCRYPT) #ifndef __TC_ECC_DH_H__ #define __TC_ECC_DH_H__ @@ -130,4 +130,4 @@ int uECC_shared_secret(const uint8_t *p_public_key, const uint8_t *p_private_key #endif #endif /* __TC_ECC_DH_H__ */ -#endif /* MBEDTLS_USE_UECC */ +#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/include/tinycrypt/ecc_dsa.h b/include/tinycrypt/ecc_dsa.h index 806534001..cc5eebcdd 100644 --- a/include/tinycrypt/ecc_dsa.h +++ b/include/tinycrypt/ecc_dsa.h @@ -75,7 +75,7 @@ * the signer's public key and the signature values (r and s). */ -#if defined(MBEDTLS_USE_UECC) +#if defined(MBEDTLS_USE_TINYCRYPT) #ifndef __TC_ECC_DSA_H__ #define __TC_ECC_DSA_H__ @@ -138,4 +138,4 @@ int uECC_verify(const uint8_t *p_public_key, const uint8_t *p_message_hash, #endif #endif /* __TC_ECC_DSA_H__ */ -#endif /* MBEDTLS_USE_UECC */ +#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/library/version_features.c b/library/version_features.c index 7dbe10796..cf0a7be4f 100644 --- a/library/version_features.c +++ b/library/version_features.c @@ -612,9 +612,9 @@ static const char *features[] = { #if defined(MBEDTLS_ECP_C) "MBEDTLS_ECP_C", #endif /* MBEDTLS_ECP_C */ -#if defined(MBEDTLS_USE_UECC) - "MBEDTLS_USE_UECC", -#endif /* MBEDTLS_USE_UECC */ +#if defined(MBEDTLS_USE_TINYCRYPT) + "MBEDTLS_USE_TINYCRYPT", +#endif /* MBEDTLS_USE_TINYCRYPT */ #if defined(MBEDTLS_ENTROPY_C) "MBEDTLS_ENTROPY_C", #endif /* MBEDTLS_ENTROPY_C */ diff --git a/programs/ssl/query_config.c b/programs/ssl/query_config.c index 266216f0f..8b6ca0985 100644 --- a/programs/ssl/query_config.c +++ b/programs/ssl/query_config.c @@ -1674,13 +1674,13 @@ int query_config( const char *config ) } #endif /* MBEDTLS_ECP_C */ -#if defined(MBEDTLS_USE_UECC) - if( strcmp( "MBEDTLS_USE_UECC", config ) == 0 ) +#if defined(MBEDTLS_USE_TINYCRYPT) + if( strcmp( "MBEDTLS_USE_TINYCRYPT", config ) == 0 ) { - MACRO_EXPANSION_TO_STR( MBEDTLS_USE_UECC ); + MACRO_EXPANSION_TO_STR( MBEDTLS_USE_TINYCRYPT ); return( 0 ); } -#endif /* MBEDTLS_USE_UECC */ +#endif /* MBEDTLS_USE_TINYCRYPT */ #if defined(MBEDTLS_ENTROPY_C) if( strcmp( "MBEDTLS_ENTROPY_C", config ) == 0 ) diff --git a/scripts/config.pl b/scripts/config.pl index d5c2ed88c..86af55394 100755 --- a/scripts/config.pl +++ b/scripts/config.pl @@ -98,7 +98,7 @@ MBEDTLS_ZLIB_SUPPORT MBEDTLS_PKCS11_C MBEDTLS_NO_UDBL_DIVISION MBEDTLS_NO_64BIT_MULTIPLICATION -MBEDTLS_USE_UECC +MBEDTLS_USE_TINYCRYPT _ALT\s*$ ); diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index d43d4784c..62b22a637 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -1030,16 +1030,16 @@ component_test_no_64bit_multiplication () { make test } -component_build_uecc_cmake () { - msg "build: uecc native, cmake" - scripts/config.pl set MBEDTLS_USE_UECC +component_build_tinycrypt_cmake () { + msg "build: tinycrypt native, cmake" + scripts/config.pl set MBEDTLS_USE_TINYCRYPT CC=gcc cmake . make } -component_build_uecc_make () { - msg "build: uecc native, make" - scripts/config.pl set MBEDTLS_USE_UECC +component_build_tinycrypt_make () { + msg "build: tinycrypt native, make" + scripts/config.pl set MBEDTLS_USE_TINYCRYPT make CC=gcc CFLAGS='-Werror -O1' } @@ -1138,10 +1138,10 @@ component_build_armcc () { armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a" } -component_build_armcc_uecc_baremetal () { - msg "build: ARM Compiler 5, make with uecc and baremetal" +component_build_armcc_tinycrypt_baremetal () { + msg "build: ARM Compiler 5, make with tinycrypt and baremetal" scripts/config.pl baremetal - scripts/config.pl set MBEDTLS_USE_UECC + scripts/config.pl set MBEDTLS_USE_TINYCRYPT make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib make clean diff --git a/tinycrypt/ecc.c b/tinycrypt/ecc.c index 090f691e9..2e694cc10 100644 --- a/tinycrypt/ecc.c +++ b/tinycrypt/ecc.c @@ -52,7 +52,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#if defined(MBEDTLS_USE_UECC) +#if defined(MBEDTLS_USE_TINYCRYPT) #include #include @@ -938,6 +938,6 @@ int uECC_compute_public_key(const uint8_t *private_key, uint8_t *public_key, return 1; } #else -typedef int mbedtls_dummy_uecc_def; -#endif /* MBEDTLS_USE_UECC */ +typedef int mbedtls_dummy_tinycrypt_def; +#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/tinycrypt/ecc_dh.c b/tinycrypt/ecc_dh.c index 5d0a52f77..28dfdf9eb 100644 --- a/tinycrypt/ecc_dh.c +++ b/tinycrypt/ecc_dh.c @@ -54,7 +54,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#if defined(MBEDTLS_USE_UECC) +#if defined(MBEDTLS_USE_TINYCRYPT) #include #include #include @@ -197,5 +197,5 @@ clear_and_out: return r; } #else -typedef int mbedtls_dummy_uecc_def; -#endif /* MBEDTLS_USE_UECC */ +typedef int mbedtls_dummy_tinycrypt_def; +#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/tinycrypt/ecc_dsa.c b/tinycrypt/ecc_dsa.c index ff8a78a3a..048fa6125 100644 --- a/tinycrypt/ecc_dsa.c +++ b/tinycrypt/ecc_dsa.c @@ -53,7 +53,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#if defined(MBEDTLS_USE_UECC) +#if defined(MBEDTLS_USE_TINYCRYPT) #include #include @@ -293,5 +293,5 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash, return (int)(uECC_vli_equal(rx, r, num_words) == 0); } #else -typedef int mbedtls_dummy_uecc_def; -#endif /* MBEDTLS_USE_UECC */ +typedef int mbedtls_dummy_tinycrypt_def; +#endif /* MBEDTLS_USE_TINYCRYPT */