ext/lib : Integrating mbedTLS to build process

Integrating the mbedTLS to the the build proccess with the minimal
Thread configuration.

Change-Id: I0ae191434d26890537a29a247c409228180410f3
Jira: ZEP-327
Jira: ZEP-340
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
This commit is contained in:
Sergio Rodriguez 2016-07-20 15:03:12 -07:00
parent 96c69cc29f
commit 312def2c78
8 changed files with 162 additions and 0 deletions

View File

@ -2,3 +2,11 @@ ifdef CONFIG_TINYCRYPT
ZEPHYRINCLUDE += -I$(srctree)/ext/lib/crypto/tinycrypt/include
endif
ifdef CONFIG_MBEDTLS_BUILTIN
ZEPHYRINCLUDE += -I$(srctree)/ext/lib/crypto/mbedtls/include
ZEPHYRINCLUDE += -I$(srctree)/ext/lib/crypto/mbedtls/configs
endif
ifdef CONFIG_MBEDTLS_LIBRARY
include $(srctree)/ext/lib/crypto/mbedtls/Makefile
endif

View File

@ -17,5 +17,6 @@
menu "Cryptography"
source "ext/lib/crypto/tinycrypt/Kconfig"
source "ext/lib/crypto/mbedtls/Kconfig"
endmenu

View File

@ -1 +1,3 @@
obj-$(CONFIG_TINYCRYPT) += tinycrypt/
obj-$(CONFIG_MBEDTLS_BUILTIN) += mbedtls/

View File

@ -0,0 +1,73 @@
include $(srctree)/ext/lib/crypto/mbedtls/Makefile.include
obj-y += library/ssl_tls.o
obj-y += library/ssl_cache.o
obj-y += library/ssl_ciphersuites.o
obj-y += library/ssl_cli.o
obj-y += library/ssl_cookie.o
obj-y += library/ssl_srv.o
obj-y += library/ssl_ticket.o
obj-y += library/debug.o
obj-y += library/net.o
obj-y += library/memory_buffer_alloc.o
obj-y += library/platform.o
obj-y += library/threading.o
obj-y += library/timing.o
obj-y += library/version.o
obj-y += library/version_features.o
obj-y += library/entropy.o
obj-y += library/entropy_poll.o
obj-y += library/error.o
obj-y += library/cipher.o
obj-y += library/cipher_wrap.o
obj-y += library/bignum.o
obj-y += library/aes.o
obj-y += library/aesni.o
obj-y += library/padlock.o
obj-y += library/arc4.o
obj-y += library/asn1parse.o
obj-y += library/asn1write.o
obj-y += library/base64.o
obj-y += library/blowfish.o
obj-y += library/camellia.o
obj-y += library/ccm.o
obj-y += library/des.o
obj-y += library/dhm.o
obj-y += library/ecdh.o
obj-y += library/ecdsa.o
obj-y += library/ecjpake.o
obj-y += library/ecp.o
obj-y += library/ecp_curves.o
obj-y += library/ctr_drbg.o
obj-y += library/gcm.o
obj-y += library/havege.o
obj-y += library/hmac_drbg.o
obj-y += library/md2.o
obj-y += library/md4.o
obj-y += library/md5.o
obj-y += library/md.o
obj-y += library/md_wrap.o
obj-y += library/oid.o
obj-y += library/pem.o
obj-y += library/pk.o
obj-y += library/pkcs12.o
obj-y += library/pkcs5.o
obj-y += library/pkparse.o
obj-y += library/pk_wrap.o
obj-y += library/pkwrite.o
obj-y += library/ripemd160.o
obj-y += library/rsa.o
obj-y += library/sha1.o
obj-y += library/sha256.o
obj-y += library/sha512.o
obj-y += library/xtea.o
obj-y += library/pkcs11.o
obj-y += library/certs.o
obj-y += library/x509.o
obj-y += library/x509_create.o
obj-y += library/x509_crl.o
obj-y += library/x509_crt.o
obj-y += library/x509_csr.o
obj-y += library/x509write_crt.o
obj-y += library/x509write_csr.o

View File

@ -0,0 +1,61 @@
# Kconfig - Cryptography primitive options for mbed TLS
#
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
menuconfig MBEDTLS
bool
prompt "mbedTLS Support"
default n
help
This option enables the mbedTLS cryptography library.
config MBEDTLS_BUILTIN
bool "Enable mbedTLS integrated sources"
depends on MBEDTLS
default n
help
Link with local mbedTLS sources instead of external library.
config MBEDTLS_CFG_FILE
string "mbed TLS configuration file"
depends on MBEDTLS_BUILTIN
default "config-threadnet.h"
help
Enable custom mbed TLS configuration
config MBEDTLS_TEST
bool "Compile internal self test functions"
depends on MBEDTLS_BUILTIN
default n
help
Enable self test function for the crypto algorithms
config MBEDTLS_LIBRARY
bool "Enable mbedTLS external library"
depends on MBEDTLS
default n
help
This option enables mbedTLS library.
config MBEDTLS_INSTALL_PATH
string "mbedTLS install path"
depends on MBEDTLS_LIBRARY
help
This option holds the path where the mbedTLS libraries and headers are
installed. Make sure this option is properly set when MBEDTLS_LIBRARY
is enabled otherwise the build will fail.

View File

@ -0,0 +1,4 @@
ifdef CONFIG_MBEDTLS_LIBRARY
LIB_INCLUDE_DIR += -L$(CONFIG_MBEDTLS_INSTALL_PATH:"%"=%)/library
ALL_LIBS += mbedtls mbedcrypto mbedx509
endif

View File

@ -0,0 +1,8 @@
subdir-ccflags-$(CONFIG_MBEDTLS_LIBRARY) += -I$(CONFIG_MBEDTLS_INSTALL_PATH)/include
subdir-ccflags-$(CONFIG_MBEDTLS_BUILTIN) += -I$(srctree)/ext/lib/crypto/mbedtls/include
subdir-ccflags-$(CONFIG_MBEDTLS_BUILTIN) += -I$(srctree)/ext/lib/crypto/mbedtls/configs
subdir-ccflags-$(CONFIG_MBEDTLS_BUILTIN) += -DMBEDTLS_CONFIG_FILE='$(CONFIG_MBEDTLS_CFG_FILE)'

View File

@ -47,6 +47,11 @@
#define MBEDTLS_PLATFORM_PRINTF_ALT
#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO int
#if defined(CONFIG_MBEDTLS_TEST)
#define MBEDTLS_SELF_TEST
#define MBEDTLS_DEBUG_C
#endif
/* mbed TLS feature support */
#define MBEDTLS_AES_ROM_TABLES
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED