1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/qdsa: use pseudomodules to select implementation

This commit is contained in:
Leandro Lanzieri 2021-11-12 12:36:44 +01:00
parent 6769101c34
commit 37b0e30a71
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
4 changed files with 33 additions and 15 deletions

View File

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

View File

@ -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)))

View File

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

View File

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