diff options
author | Sergio Rodriguez <sergio.sf.rodriguez@intel.com> | 2016-07-20 15:03:12 -0700 |
---|---|---|
committer | Sergio Rodriguez <sergio.sf.rodriguez@intel.com> | 2016-07-26 16:00:04 -0700 |
commit | 312def2c78573c5a9e50b0b73f1cf685898ca98d (patch) | |
tree | d44fa19079285b0536f0b774ff5950329691f121 /ext | |
parent | 96c69cc29ff7574c808566cbbac495d9995ef361 (diff) |
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>
Diffstat (limited to 'ext')
-rw-r--r-- | ext/lib/Makefile | 8 | ||||
-rw-r--r-- | ext/lib/crypto/Kconfig | 1 | ||||
-rw-r--r-- | ext/lib/crypto/Makefile | 2 | ||||
-rw-r--r-- | ext/lib/crypto/mbedtls/Kbuild | 73 | ||||
-rw-r--r-- | ext/lib/crypto/mbedtls/Kconfig | 61 | ||||
-rw-r--r-- | ext/lib/crypto/mbedtls/Makefile | 4 | ||||
-rw-r--r-- | ext/lib/crypto/mbedtls/Makefile.include | 8 | ||||
-rw-r--r-- | ext/lib/crypto/mbedtls/configs/config-threadnet.h | 5 |
8 files changed, 162 insertions, 0 deletions
diff --git a/ext/lib/Makefile b/ext/lib/Makefile index 118113c0e..af811719d 100644 --- a/ext/lib/Makefile +++ b/ext/lib/Makefile @@ -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 diff --git a/ext/lib/crypto/Kconfig b/ext/lib/crypto/Kconfig index 284bad660..859d4a393 100644 --- a/ext/lib/crypto/Kconfig +++ b/ext/lib/crypto/Kconfig @@ -17,5 +17,6 @@ menu "Cryptography" source "ext/lib/crypto/tinycrypt/Kconfig" +source "ext/lib/crypto/mbedtls/Kconfig" endmenu diff --git a/ext/lib/crypto/Makefile b/ext/lib/crypto/Makefile index f51a9e6ca..029cf15c2 100644 --- a/ext/lib/crypto/Makefile +++ b/ext/lib/crypto/Makefile @@ -1 +1,3 @@ obj-$(CONFIG_TINYCRYPT) += tinycrypt/ +obj-$(CONFIG_MBEDTLS_BUILTIN) += mbedtls/ + diff --git a/ext/lib/crypto/mbedtls/Kbuild b/ext/lib/crypto/mbedtls/Kbuild new file mode 100644 index 000000000..e7c586aa9 --- /dev/null +++ b/ext/lib/crypto/mbedtls/Kbuild @@ -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 diff --git a/ext/lib/crypto/mbedtls/Kconfig b/ext/lib/crypto/mbedtls/Kconfig new file mode 100644 index 000000000..15ee42b99 --- /dev/null +++ b/ext/lib/crypto/mbedtls/Kconfig @@ -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. diff --git a/ext/lib/crypto/mbedtls/Makefile b/ext/lib/crypto/mbedtls/Makefile new file mode 100644 index 000000000..5be61e87e --- /dev/null +++ b/ext/lib/crypto/mbedtls/Makefile @@ -0,0 +1,4 @@ +ifdef CONFIG_MBEDTLS_LIBRARY +LIB_INCLUDE_DIR += -L$(CONFIG_MBEDTLS_INSTALL_PATH:"%"=%)/library +ALL_LIBS += mbedtls mbedcrypto mbedx509 +endif diff --git a/ext/lib/crypto/mbedtls/Makefile.include b/ext/lib/crypto/mbedtls/Makefile.include new file mode 100644 index 000000000..319482c29 --- /dev/null +++ b/ext/lib/crypto/mbedtls/Makefile.include @@ -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)' diff --git a/ext/lib/crypto/mbedtls/configs/config-threadnet.h b/ext/lib/crypto/mbedtls/configs/config-threadnet.h index 02ae3328c..908ade364 100644 --- a/ext/lib/crypto/mbedtls/configs/config-threadnet.h +++ b/ext/lib/crypto/mbedtls/configs/config-threadnet.h @@ -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 |