2 # Copyright (C) 2011-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
12 PKG_RELEASE
:=$(AUTORELEASE
)
16 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
17 PKG_SOURCE_URL
:=https
://codeload.github.com
/ARMmbed
/mbedtls
/tar.gz
/v
$(PKG_VERSION
)?
18 PKG_HASH
:=6797a7b6483ef589deeab8d33d401ed235d7be25eeecda1be8ddfed406d40ff4
20 PKG_LICENSE
:=GPL-2.0
-or-later
21 PKG_LICENSE_FILES
:=gpl-2.0.txt
22 PKG_CPE_ID
:=cpe
:/a
:arm
:mbed_tls
24 PKG_CONFIG_DEPENDS
:= \
25 CONFIG_LIBMBEDTLS_DEBUG_C \
26 CONFIG_LIBMBEDTLS_HKDF_C
28 include $(INCLUDE_DIR
)/package.mk
29 include $(INCLUDE_DIR
)/cmake.mk
31 define Package
/mbedtls
/Default
33 URL
:=https
://tls.mbed.org
36 define Package
/mbedtls
/Default
/description
37 The aim of the mbedtls project is to provide a quality
, open-source
38 cryptographic library written in C and targeted at embedded systems.
41 define Package
/libmbedtls
42 $(call Package
/mbedtls
/Default
)
50 define Package
/libmbedtls
/config
51 config LIBMBEDTLS_DEBUG_C
52 depends on PACKAGE_libmbedtls
53 bool
"Enable debug functions"
56 This option enables mbedtls library
's debug functions.
58 It increases the uncompressed libmbedtls binary size
59 by around 60 KiB (for an ARMv5 platform).
61 Usually, you don't need this
, so don
't select this if you're unsure.
63 config LIBMBEDTLS_HKDF_C
64 depends on PACKAGE_libmbedtls
65 bool
"Enable the HKDF algorithm (RFC 5869)"
68 This option adds support for the Hashed Message Authentication Code
69 (HMAC
)-based key derivation function
(HKDF
).
72 define Package
/mbedtls-util
73 $(call Package
/mbedtls
/Default
)
80 define Package
/libmbedtls
/description
81 $(call Package
/mbedtls
/Default
/description
)
82 This package contains the mbedtls library.
85 define Package
/mbedtls-util
/description
86 $(call Package
/mbedtls
/Default
/description
)
87 This package contains mbedtls helper programs for private key and
88 CSR generation
(gen_key
, cert_req
)
91 TARGET_CFLAGS
+= -ffunction-sections
-fdata-sections
92 TARGET_CFLAGS
:= $(filter-out -O
%,$(TARGET_CFLAGS
))
95 -DCMAKE_POSITION_INDEPENDENT_CODE
=ON \
96 -DUSE_SHARED_MBEDTLS_LIBRARY
:Bool
=ON \
97 -DENABLE_TESTING
:Bool
=OFF \
98 -DENABLE_PROGRAMS
:Bool
=ON
100 define Build
/Configure
101 $(Build
/Configure
/Default
)
103 awk
'BEGIN { rc = 1 } \
104 /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \
106 END { exit(rc) }' $(PKG_BUILD_DIR
)/include/mbedtls
/config.h \
107 >$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
&& \
108 mv
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h
110 awk
'BEGIN { rc = 1 } \
111 /#define MBEDTLS_HKDF_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_HKDF_C),,// )#define MBEDTLS_HKDF_C"; rc = 0 } \
113 END { exit(rc) }' $(PKG_BUILD_DIR
)/include/mbedtls
/config.h \
114 >$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
&& \
115 mv
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h
117 sed
-i
'/fuzz/d' $(PKG_BUILD_DIR
)/programs
/CMakeLists.txt
118 sed
-i
'/test/d' $(PKG_BUILD_DIR
)/programs
/CMakeLists.txt
121 define Build
/InstallDev
122 $(INSTALL_DIR
) $(1)/usr
/include
123 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/mbedtls
$(1)/usr
/include/
124 $(INSTALL_DIR
) $(1)/usr
/lib
125 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.so
* $(1)/usr
/lib
/
126 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.a
$(1)/usr
/lib
/
129 define Package
/libmbedtls
/install
130 $(INSTALL_DIR
) $(1)/usr
/lib
131 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.so.
* $(1)/usr
/lib
/
134 define Package
/mbedtls-util
/install
135 $(INSTALL_DIR
) $(1)/usr
/bin
136 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/gen_key
$(1)/usr
/bin
/
137 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/cert_req
$(1)/usr
/bin
/
140 $(eval
$(call BuildPackage
,libmbedtls
))
141 $(eval
$(call BuildPackage
,mbedtls-util
))