diff --git a/pkg/qdsa/Kconfig b/pkg/qdsa/Kconfig index 2f4ad5864d..8b470f7ed8 100644 --- a/pkg/qdsa/Kconfig +++ b/pkg/qdsa/Kconfig @@ -9,12 +9,28 @@ config PACKAGE_QDSA bool "qDSA Digital Signatures package" depends on TEST_KCONFIG depends on !HAS_ARCH_16BIT - select MODULE_QDSA_ASM if HAS_ARCH_AVR8 || CPU_CORE_CORTEX_M23 - select MODULE_QDSA_ASM if CPU_CORE_CORTEX_M0 || CPU_CORE_CORTEX_M0PLUS help Small and Secure Digital Signatures with Curve-based Diffie-Hellman Key Pairs. +if PACKAGE_QDSA + config MODULE_QDSA_ASM bool + default y if HAS_ARCH_AVR8 || CPU_CORE_CORTEX_M23 + default y if CPU_CORE_CORTEX_M0 || CPU_CORE_CORTEX_M0PLUS depends on TEST_KCONFIG + +config MODULE_QDSA_IMPL_ARM + bool + default y if CPU_CORE_CORTEX_M23 || CPU_CORE_CORTEX_M0 || CPU_CORE_CORTEX_M0PLUS + +config MODULE_QDSA_IMPL_AVR + bool + default y if HAS_ARCH_AVR8 + +config MODULE_QDSA_IMPL_CREF + bool + default y if !MODULE_QDSA_IMPL_ARM && !MODULE_QDSA_IMPL_AVR + +endif # PACKAGE_QDSA diff --git a/pkg/qdsa/Makefile b/pkg/qdsa/Makefile index 6c4035c4ca..061abd8fce 100644 --- a/pkg/qdsa/Makefile +++ b/pkg/qdsa/Makefile @@ -6,4 +6,4 @@ PKG_LICENSE=PD include $(RIOTBASE)/pkg/pkg.mk all: - $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/$(QDSA_IMPL) + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/$(patsubst qdsa_impl_%,%,$(filter qdsa_impl_%,$(USEMODULE))) diff --git a/pkg/qdsa/Makefile.dep b/pkg/qdsa/Makefile.dep index dbf3943b42..5590d615e3 100644 --- a/pkg/qdsa/Makefile.dep +++ b/pkg/qdsa/Makefile.dep @@ -6,5 +6,15 @@ ifneq (,$(filter arch_avr8,$(FEATURES_USED))) USEMODULE += qdsa_asm endif +ifeq (,$(filter qdsa_impl_%,$(USEMODULE))) + ifneq (,$(filter cortex-m23 cortex-m0%,$(CPU_CORE))) + USEMODULE += qdsa_impl_arm + else ifneq (,$(filter arch_avr8,$(FEATURES_USED))) + USEMODULE += qdsa_impl_avr + else + USEMODULE += qdsa_impl_cref + endif +endif + # qDsa is not 16 bit compatible FEATURES_BLACKLIST += arch_16bit diff --git a/pkg/qdsa/Makefile.include b/pkg/qdsa/Makefile.include index 245e84adc3..9a41247f74 100644 --- a/pkg/qdsa/Makefile.include +++ b/pkg/qdsa/Makefile.include @@ -1,16 +1,8 @@ -ifneq (,$(filter cortex-m23 cortex-m0%,$(CPU_CORE))) - QDSA_IMPL ?= arm -else - ifneq (,$(filter arch_avr8,$(FEATURES_USED))) - QDSA_IMPL ?= avr - else - QDSA_IMPL ?= cref - endif -endif +PSEUDOMODULES += qdsa_impl_arm +PSEUDOMODULES += qdsa_impl_avr +PSEUDOMODULES += qdsa_impl_cref -export QDSA_IMPL - -INCLUDES += -I$(PKGDIRBASE)/qdsa/$(QDSA_IMPL) +INCLUDES += -I$(PKGDIRBASE)/qdsa/$(patsubst qdsa_impl_%,%,$(filter qdsa_impl_%,$(USEMODULE))) ifeq (cortex-m0plus,$(CPU_CORE)) # There are problems with the LLVM assembler and the Cortex-M0+ instruction