From 35e535a74a2a832a646a7eb13152eabf4d40a748 Mon Sep 17 00:00:00 2001 From: Simon Butcher Date: Thu, 21 Nov 2019 17:17:05 +0000 Subject: [PATCH] Remove TinyCrypt config condition in source files This commit removes from the TinyCrypt header and source code files, the configuration condition on MBEDTLS_USE_TINYCRYPT to include the file contents. This is to allow use of the library by the Factory Tool without enabling MBEDTLS_USE_TINYCRYPT, and also removes a modification we've made to make the code closer to the upstream TinyCrypt making it easier to maintain. --- include/tinycrypt/ecc.h | 2 -- include/tinycrypt/ecc_dh.h | 2 -- include/tinycrypt/ecc_dsa.h | 2 -- tinycrypt/ecc.c | 4 ---- tinycrypt/ecc_dh.c | 4 ---- tinycrypt/ecc_dsa.c | 4 ---- 6 files changed, 18 deletions(-) diff --git a/include/tinycrypt/ecc.h b/include/tinycrypt/ecc.h index 2da74b3c0..e4435fdde 100644 --- a/include/tinycrypt/ecc.h +++ b/include/tinycrypt/ecc.h @@ -73,7 +73,6 @@ * */ -#if defined(MBEDTLS_USE_TINYCRYPT) #ifndef __TC_UECC_H__ #define __TC_UECC_H__ @@ -528,4 +527,3 @@ void uECC_vli_bytesToNative(unsigned int *native, const uint8_t *bytes, #endif #endif /* __TC_UECC_H__ */ -#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/include/tinycrypt/ecc_dh.h b/include/tinycrypt/ecc_dh.h index a2edb0155..d87393d22 100644 --- a/include/tinycrypt/ecc_dh.h +++ b/include/tinycrypt/ecc_dh.h @@ -71,7 +71,6 @@ * Security: The curve NIST p-256 provides approximately 128 bits of security. */ -#if defined(MBEDTLS_USE_TINYCRYPT) #ifndef __TC_ECC_DH_H__ #define __TC_ECC_DH_H__ @@ -135,4 +134,3 @@ 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_TINYCRYPT */ diff --git a/include/tinycrypt/ecc_dsa.h b/include/tinycrypt/ecc_dsa.h index e54a77e85..896e20ecf 100644 --- a/include/tinycrypt/ecc_dsa.h +++ b/include/tinycrypt/ecc_dsa.h @@ -80,7 +80,6 @@ * the signer's public key and the signature values (r and s). */ -#if defined(MBEDTLS_USE_TINYCRYPT) #ifndef __TC_ECC_DSA_H__ #define __TC_ECC_DSA_H__ @@ -143,4 +142,3 @@ int uECC_verify(const uint8_t *p_public_key, const uint8_t *p_message_hash, #endif #endif /* __TC_ECC_DSA_H__ */ -#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/tinycrypt/ecc.c b/tinycrypt/ecc.c index d01c67617..14fa582cc 100644 --- a/tinycrypt/ecc.c +++ b/tinycrypt/ecc.c @@ -63,7 +63,6 @@ #include MBEDTLS_CONFIG_FILE #endif -#if defined(MBEDTLS_USE_TINYCRYPT) #include #include "mbedtls/platform_util.h" #include @@ -1114,7 +1113,4 @@ int uECC_compute_public_key(const uint8_t *private_key, uint8_t *public_key, curve->num_bytes, curve->num_bytes, _public + curve->num_words); return 1; } -#else -typedef int mbedtls_dummy_tinycrypt_def; -#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/tinycrypt/ecc_dh.c b/tinycrypt/ecc_dh.c index f9c0a5ed1..3ab7b1582 100644 --- a/tinycrypt/ecc_dh.c +++ b/tinycrypt/ecc_dh.c @@ -66,7 +66,6 @@ #include MBEDTLS_CONFIG_FILE #endif -#if defined(MBEDTLS_USE_TINYCRYPT) #include #include #include @@ -188,6 +187,3 @@ clear_and_out: return r; } -#else -typedef int mbedtls_dummy_tinycrypt_def; -#endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/tinycrypt/ecc_dsa.c b/tinycrypt/ecc_dsa.c index 04b1bfabd..b44fa3711 100644 --- a/tinycrypt/ecc_dsa.c +++ b/tinycrypt/ecc_dsa.c @@ -64,7 +64,6 @@ #include MBEDTLS_CONFIG_FILE #endif -#if defined(MBEDTLS_USE_TINYCRYPT) #include #include @@ -303,6 +302,3 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash, /* Accept only if v == r. */ return (int)(uECC_vli_equal(rx, r) == 0); } -#else -typedef int mbedtls_dummy_tinycrypt_def; -#endif /* MBEDTLS_USE_TINYCRYPT */