diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 4f754c367b..0ee32ee9db 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -30,6 +30,8 @@ source "net/Kconfig" source "misc/Kconfig" +source "lib/Kconfig" + # # The following are for Kconfig files for default values only. # These should be parsed at the end. diff --git a/Makefile b/Makefile index e22ef9c4af..7cd03ca2dd 100644 --- a/Makefile +++ b/Makefile @@ -557,12 +557,7 @@ else include/config/auto.conf: ; endif # $(dot-config) -ifdef CONFIG_TINYCRYPT -# Objects we will link into the kernel / subdirs we need to visit -KCRYPTO_DIR := lib/crypto/tinycrypt -libs-y += $(KCRYPTO_DIR)/ - ZEPHYRINCLUDE += -I$(srctree)/lib/crypto/tinycrypt/include -endif +-include $(srctree)/lib/Makefile ARCH = $(subst $(DQUOTE),,$(CONFIG_ARCH)) export ARCH diff --git a/lib/Kbuild b/lib/Kbuild new file mode 100644 index 0000000000..7245720096 --- /dev/null +++ b/lib/Kbuild @@ -0,0 +1,2 @@ +obj-y += libc/ +obj-y += crypto/ diff --git a/lib/crypto/Kconfig b/lib/Kconfig similarity index 83% rename from lib/crypto/Kconfig rename to lib/Kconfig index aac98e676a..088fbf4b06 100644 --- a/lib/crypto/Kconfig +++ b/lib/Kconfig @@ -1,7 +1,5 @@ -# Kconfig - cryptography configuration options - # -# Copyright (c) 2015 Intel Corporation +# 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. @@ -16,8 +14,8 @@ # limitations under the License. # + menu "Cryptography" - -source "tinycrypt/Kconfig" - +source "lib/crypto/tinycrypt/Kconfig" endmenu + diff --git a/lib/Makefile b/lib/Makefile index 7a484c417c..11a2853564 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1 +1,4 @@ -obj-y := libc/ + +ifeq ($(CONFIG_TINYCRYPT),y) +ZEPHYRINCLUDE += -I$(srctree)/lib/crypto/tinycrypt/include +endif diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index b25ada5eb6..f51a9e6ca5 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -1 +1 @@ -libs-$(CONFIG_TINYCRYPT) += tinycrypt/ +obj-$(CONFIG_TINYCRYPT) += tinycrypt/ diff --git a/lib/crypto/tinycrypt/Makefile b/lib/crypto/tinycrypt/Makefile index c4a5a7a1ca..1ffccdc9ee 100644 --- a/lib/crypto/tinycrypt/Makefile +++ b/lib/crypto/tinycrypt/Makefile @@ -1,14 +1,15 @@ -ccflags-y +=-I$(srctree)/lib/crypto/tinycrypt/include -lib-$(CONFIG_TINYCRYPT) := source/utils.o -lib-$(CONFIG_TINYCRYPT_ECC_DH) += source/ecc_dh.o source/ecc.o -lib-$(CONFIG_TINYCRYPT_ECC_DSA) += source/ecc_dsa.o source/ecc.o -lib-$(CONFIG_TINYCRYPT_AES) += source/aes_decrypt.o -lib-$(CONFIG_TINYCRYPT_AES) += source/aes_encrypt.o -lib-$(CONFIG_TINYCRYPT_AES_CBC) += source/cbc_mode.o -lib-$(CONFIG_TINYCRYPT_AES_CTR) += source/ctr_mode.o -lib-$(CONFIG_TINYCRYPT_AES_CCM) += source/ccm_mode.o -lib-$(CONFIG_TINYCRYPT_AES_CMAC) += source/cmac_mode.o -lib-$(CONFIG_TINYCRYPT_SHA256) += source/sha256.o -lib-$(CONFIG_TINYCRYPT_SHA256) += source/utils.o -lib-$(CONFIG_TINYCRYPT_SHA256_HMAC) += source/hmac.o -lib-$(CONFIG_TINYCRYPT_SHA256_HMAC_PRNG) += source/hmac_prng.o +subdir-ccflags-y +=-I$(srctree)/lib/crypto/tinycrypt/include + +obj-$(CONFIG_TINYCRYPT) := source/utils.o +obj-$(CONFIG_TINYCRYPT_ECC_DH) += source/ecc_dh.o source/ecc.o +obj-$(CONFIG_TINYCRYPT_ECC_DSA) += source/ecc_dsa.o source/ecc.o +obj-$(CONFIG_TINYCRYPT_AES) += source/aes_decrypt.o +obj-$(CONFIG_TINYCRYPT_AES) += source/aes_encrypt.o +obj-$(CONFIG_TINYCRYPT_AES_CBC) += source/cbc_mode.o +obj-$(CONFIG_TINYCRYPT_AES_CTR) += source/ctr_mode.o +obj-$(CONFIG_TINYCRYPT_AES_CCM) += source/ccm_mode.o +obj-$(CONFIG_TINYCRYPT_AES_CMAC) += source/cmac_mode.o +obj-$(CONFIG_TINYCRYPT_SHA256) += source/sha256.o +obj-$(CONFIG_TINYCRYPT_SHA256) += source/utils.o +obj-$(CONFIG_TINYCRYPT_SHA256_HMAC) += source/hmac.o +obj-$(CONFIG_TINYCRYPT_SHA256_HMAC_PRNG) += source/hmac_prng.o diff --git a/misc/Kconfig b/misc/Kconfig index 92aed0b4fe..5cecbbc98b 100644 --- a/misc/Kconfig +++ b/misc/Kconfig @@ -16,11 +16,6 @@ # limitations under the License. # - -menu "Cryptography" -source "lib/crypto/tinycrypt/Kconfig" -endmenu - menu "Compile and Link Features" config KERNEL_BIN_NAME