2015-12-29 16:03:07 +01:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# mbedtls
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2022-01-08 16:19:54 +01:00
|
|
|
MBEDTLS_VERSION = 2.28.0
|
2020-09-01 20:15:03 +02:00
|
|
|
MBEDTLS_SITE = $(call github,ARMmbed,mbedtls,v$(MBEDTLS_VERSION))
|
2015-12-29 16:03:07 +01:00
|
|
|
MBEDTLS_CONF_OPTS = \
|
2022-01-10 18:44:11 +01:00
|
|
|
-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -std=c99" \
|
2015-12-29 16:03:07 +01:00
|
|
|
-DENABLE_PROGRAMS=$(if $(BR2_PACKAGE_MBEDTLS_PROGRAMS),ON,OFF) \
|
2022-01-09 19:06:57 +01:00
|
|
|
-DENABLE_TESTING=OFF \
|
|
|
|
-DMBEDTLS_FATAL_WARNINGS=OFF
|
2015-12-29 16:03:07 +01:00
|
|
|
MBEDTLS_INSTALL_STAGING = YES
|
|
|
|
MBEDTLS_LICENSE = Apache-2.0
|
2022-01-08 16:19:54 +01:00
|
|
|
MBEDTLS_LICENSE_FILES = LICENSE
|
2021-01-24 00:13:54 +01:00
|
|
|
MBEDTLS_CPE_ID_VENDOR = arm
|
|
|
|
MBEDTLS_CPE_ID_PRODUCT = mbed_tls
|
2015-12-29 16:03:07 +01:00
|
|
|
|
|
|
|
# This is mandatory for hiawatha
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
|
|
|
|
define MBEDTLS_ENABLE_THREADING
|
|
|
|
$(SED) "s://#define MBEDTLS_THREADING_C:#define MBEDTLS_THREADING_C:" \
|
|
|
|
$(@D)/include/mbedtls/config.h
|
|
|
|
$(SED) "s://#define MBEDTLS_THREADING_PTHREAD:#define MBEDTLS_THREADING_PTHREAD:" \
|
|
|
|
$(@D)/include/mbedtls/config.h
|
|
|
|
endef
|
|
|
|
MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_THREADING
|
2016-04-12 20:46:00 +02:00
|
|
|
ifeq ($(BR2_STATIC_LIBS),y)
|
|
|
|
MBEDTLS_CONF_OPTS += -DLINK_WITH_PTHREAD=ON
|
|
|
|
endif
|
2015-12-29 16:03:07 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_STATIC_LIBS),y)
|
|
|
|
MBEDTLS_CONF_OPTS += \
|
|
|
|
-DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON
|
|
|
|
else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
|
|
|
|
MBEDTLS_CONF_OPTS += \
|
|
|
|
-DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=ON
|
|
|
|
else ifeq ($(BR2_SHARED_LIBS),y)
|
|
|
|
MBEDTLS_CONF_OPTS += \
|
|
|
|
-DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF
|
|
|
|
endif
|
|
|
|
|
2017-02-06 21:01:23 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_MBEDTLS_COMPRESSION),y)
|
2015-12-29 16:03:07 +01:00
|
|
|
MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=ON
|
|
|
|
MBEDTLS_DEPENDENCIES += zlib
|
2017-01-29 22:15:11 +01:00
|
|
|
define MBEDTLS_ENABLE_ZLIB
|
|
|
|
$(SED) "s://#define MBEDTLS_ZLIB_SUPPORT:#define MBEDTLS_ZLIB_SUPPORT:" \
|
|
|
|
$(@D)/include/mbedtls/config.h
|
|
|
|
endef
|
|
|
|
MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_ZLIB
|
2015-12-29 16:03:07 +01:00
|
|
|
else
|
|
|
|
MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=OFF
|
|
|
|
endif
|
|
|
|
|
2015-12-30 13:07:03 +01:00
|
|
|
define MBEDTLS_DISABLE_ASM
|
|
|
|
$(SED) '/^#define MBEDTLS_AESNI_C/d' \
|
|
|
|
$(@D)/include/mbedtls/config.h
|
|
|
|
$(SED) '/^#define MBEDTLS_HAVE_ASM/d' \
|
|
|
|
$(@D)/include/mbedtls/config.h
|
|
|
|
$(SED) '/^#define MBEDTLS_PADLOCK_C/d' \
|
|
|
|
$(@D)/include/mbedtls/config.h
|
|
|
|
endef
|
|
|
|
|
|
|
|
# ARM in thumb mode breaks debugging with asm optimizations
|
|
|
|
# Microblaze asm optimizations are broken in general
|
|
|
|
# MIPS R6 asm is not yet supported
|
|
|
|
ifeq ($(BR2_ENABLE_DEBUG)$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),yy)
|
|
|
|
MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
|
2016-09-30 11:36:49 +02:00
|
|
|
else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
|
2015-12-30 13:07:03 +01:00
|
|
|
MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
|
|
|
|
endif
|
|
|
|
|
2015-12-29 16:03:07 +01:00
|
|
|
$(eval $(cmake-package))
|