Merge remote-tracking branch 'public/pr/2932' into baremetal

This commit is contained in:
Simon Butcher 2019-12-05 14:32:31 +00:00
commit 5b45c6e1b3
11 changed files with 22 additions and 24 deletions

View file

@ -185,7 +185,10 @@ endif(ENABLE_ZLIB_SUPPORT)
add_subdirectory(library)
add_subdirectory(include)
add_subdirectory(tinycrypt)
if(USE_TINYCRYPT)
add_subdirectory(tinycrypt)
endif()
if(ENABLE_PROGRAMS)
add_subdirectory(programs)

View file

@ -73,7 +73,6 @@
*
*/
#if defined(MBEDTLS_USE_TINYCRYPT)
#ifndef __TC_UECC_H__
#define __TC_UECC_H__
@ -535,4 +534,3 @@ void uECC_vli_bytesToNative(unsigned int *native, const uint8_t *bytes,
#endif
#endif /* __TC_UECC_H__ */
#endif /* MBEDTLS_USE_TINYCRYPT */

View file

@ -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 */

View file

@ -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 */

View file

@ -1,4 +1,5 @@
option(USE_STATIC_MBEDTLS_LIBRARY "Build mbed TLS static library." ON)
option(USE_TINYCRYPT "Include TinyCrypt." ON)
option(USE_SHARED_MBEDTLS_LIBRARY "Build mbed TLS shared library." OFF)
option(LINK_WITH_PTHREAD "Explicitly link mbed TLS library to pthread." OFF)
@ -123,7 +124,9 @@ if(LINK_WITH_PTHREAD)
set(libs ${libs} pthread)
endif()
set(libs ${libs} tinycrypt)
if(USE_TINYCRYPT)
set(libs ${libs} tinycrypt)
endif()
if (NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY)
message(FATAL_ERROR "Need to choose static or shared mbedtls build!")

View file

@ -99,8 +99,7 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \
ripemd160.o rsa_internal.o rsa.o \
sha1.o sha256.o sha512.o \
threading.o timing.o version.o \
version_features.o xtea.o \
ecc.o ecc_dh.o ecc_dsa.o
version_features.o xtea.o
OBJS_X509= certs.o pkcs11.o x509.o
@ -110,6 +109,17 @@ OBJS_TLS= debug.o net_sockets.o \
ssl_srv.o ssl_ticket.o \
ssl_tls.o
# Default to always build TinyCrypt
ifndef TINYCRYPT_BUILD
TINYCRYPT_BUILD=1
endif
ifeq ($(TINYCRYPT_BUILD),1)
# Add TinyCrypt to the targets and Makefile path
VPATH = ../tinycrypt
OBJS_CRYPTO += ecc.o ecc_dh.o ecc_dsa.o
endif
.SILENT:
.PHONY: all static shared clean

View file

@ -1491,7 +1491,7 @@ component_build_arm_none_eabi_gcc_no_64bit_multiplication () {
msg "build: arm-none-eabi-gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s
scripts/config.pl baremetal
scripts/config.pl set MBEDTLS_NO_64BIT_MULTIPLICATION
make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -O1 -march=armv6-m -mthumb' lib
make TINYCRYPT_BUILD=0 CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -O1 -march=armv6-m -mthumb' lib
echo "Checking that software 64-bit multiplication is not required"
if_build_succeeded not grep __aeabi_lmul library/*.o
}

View file

@ -16,7 +16,7 @@ cp include/mbedtls/config.h include/mbedtls/config.h.bak
scripts/config.pl full
make clean
make_ret=
CFLAGS=-fno-asynchronous-unwind-tables make lib \
CFLAGS=-fno-asynchronous-unwind-tables TINYCRYPT_BUILD=0 make lib \
>list-symbols.make.log 2>&1 ||
{
make_ret=$?

View file

@ -63,7 +63,6 @@
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_USE_TINYCRYPT)
#include <tinycrypt/ecc.h>
#include "mbedtls/platform_util.h"
#include <string.h>
@ -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 */

View file

@ -66,7 +66,6 @@
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_USE_TINYCRYPT)
#include <tinycrypt/ecc.h>
#include <tinycrypt/ecc_dh.h>
#include <string.h>
@ -188,6 +187,3 @@ clear_and_out:
return r;
}
#else
typedef int mbedtls_dummy_tinycrypt_def;
#endif /* MBEDTLS_USE_TINYCRYPT */

View file

@ -64,7 +64,6 @@
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_USE_TINYCRYPT)
#include <tinycrypt/ecc.h>
#include <tinycrypt/ecc_dsa.h>
#include "mbedtls/platform_util.h"
@ -316,6 +315,3 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash,
return UECC_FAILURE;
}
#else
typedef int mbedtls_dummy_tinycrypt_def;
#endif /* MBEDTLS_USE_TINYCRYPT */