diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index 413713c49..30e25bf45 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 24501abf9..4805537b2 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -2279,18 +2279,20 @@ #define MBEDTLS_ECP_C /** - * \def MBEDTLS_USE_UECC + * \def MBEDTLS_USE_TINYCRYPT * - * Enable the tinycrypt ECC library. + * Enable the TinyCrypt ECC library. This module provides alternative ECC + * handling functions replacing the native Mbed TLS ECP module. + * + * TinyCrypt is a project independent from Mbed TLS, licensed under 3-clause + * BSD, and can be found at https://github.com/intel/tinycrypt - this option + * only enables the ECC modules from TinyCrypt. * * Module: tinycrypt/ecc.c * tinycrypt/ecc_dh.c * tinycrypt/ecc_dsa.c - * - * 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 74a0a0e7b..a675bb68e 100644 --- a/library/version_features.c +++ b/library/version_features.c @@ -615,9 +615,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 6c76f47a5..57bf2e708 100644 --- a/programs/ssl/query_config.c +++ b/programs/ssl/query_config.c @@ -1682,13 +1682,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 7bff5bca1..72e7c3e88 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -1047,16 +1047,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' } @@ -1155,10 +1155,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 */