2 # Copyright (C) 2006-2016 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
13 PKG_VERSION
:=$(PKG_BASE
)$(PKG_BUGFIX
)
16 ENGINES_DIR
=engines-1.1
20 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
22 http
://www.openssl.org
/source
/ \
23 http
://www.openssl.org
/source
/old
/$(PKG_BASE
)/ \
24 http
://ftp.fi.muni.cz
/pub
/openssl
/source
/ \
25 http
://ftp.fi.muni.cz
/pub
/openssl
/source
/old
/$(PKG_BASE
)/ \
26 ftp
://ftp.pca.dfn.de
/pub
/tools
/net
/openssl
/source
/ \
27 ftp
://ftp.pca.dfn.de
/pub
/tools
/net
/openssl
/source
/old
/$(PKG_BASE
)/
29 PKG_HASH
:=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
32 PKG_LICENSE_FILES
:=LICENSE
33 PKG_MAINTAINER
:=Eneas U de Queiroz
<cotequeiroz@gmail.com
>
34 PKG_CPE_ID
:=cpe
:/a
:openssl
:openssl
35 PKG_CONFIG_DEPENDS
:= \
36 CONFIG_OPENSSL_ENGINE \
37 CONFIG_OPENSSL_ENGINE_BUILTIN \
38 CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG \
39 CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO \
40 CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK \
41 CONFIG_OPENSSL_NO_DEPRECATED \
42 CONFIG_OPENSSL_OPTIMIZE_SPEED \
43 CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM \
44 CONFIG_OPENSSL_WITH_ARIA \
45 CONFIG_OPENSSL_WITH_ASM \
46 CONFIG_OPENSSL_WITH_ASYNC \
47 CONFIG_OPENSSL_WITH_BLAKE2 \
48 CONFIG_OPENSSL_WITH_CAMELLIA \
49 CONFIG_OPENSSL_WITH_CHACHA_POLY1305 \
50 CONFIG_OPENSSL_WITH_CMS \
51 CONFIG_OPENSSL_WITH_COMPRESSION \
52 CONFIG_OPENSSL_WITH_DTLS \
53 CONFIG_OPENSSL_WITH_EC2M \
54 CONFIG_OPENSSL_WITH_ERROR_MESSAGES \
55 CONFIG_OPENSSL_WITH_IDEA \
56 CONFIG_OPENSSL_WITH_MDC2 \
57 CONFIG_OPENSSL_WITH_NPN \
58 CONFIG_OPENSSL_WITH_PSK \
59 CONFIG_OPENSSL_WITH_RFC3779 \
60 CONFIG_OPENSSL_WITH_SEED \
61 CONFIG_OPENSSL_WITH_SM234 \
62 CONFIG_OPENSSL_WITH_SRP \
63 CONFIG_OPENSSL_WITH_SSE2 \
64 CONFIG_OPENSSL_WITH_TLS13 \
65 CONFIG_OPENSSL_WITH_WHIRLPOOL
67 include $(INCLUDE_DIR
)/package.mk
69 ifneq ($(CONFIG_CCACHE
),)
70 HOSTCC
=$(HOSTCC_NOCACHE
)
71 HOSTCXX
=$(HOSTCXX_NOCACHE
)
74 define Package
/openssl
/Default
75 TITLE
:=Open source SSL toolkit
76 URL
:=http
://www.openssl.org
/
81 define Package
/libopenssl
/config
82 source
"$(SOURCE)/Config.in"
85 define Package
/openssl
/Default
/description
86 The OpenSSL Project is a collaborative effort to develop a robust
,
87 commercial-grade
, full-featured
, and Open Source toolkit implementing the
88 Transport Layer Security
(TLS
) protocol
as well
as a full-strength
89 general-purpose cryptography library.
92 define Package
/libopenssl
93 $(call Package
/openssl
/Default
)
95 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib \
96 +OPENSSL_ENGINE_BUILTIN_AFALG
:kmod-crypto-user \
97 +OPENSSL_ENGINE_BUILTIN_DEVCRYPTO
:kmod-cryptodev \
98 +OPENSSL_ENGINE_BUILTIN_PADLOCK
:kmod-crypto-hw-padlock
104 define Package
/libopenssl
/description
105 $(call Package
/openssl
/Default
/description
)
106 This package contains the OpenSSL shared libraries
, needed by other programs.
109 define Package
/openssl-util
110 $(call Package
/openssl
/Default
)
113 DEPENDS
:=+libopenssl
+libopenssl-conf
117 define Package
/openssl-util
/description
118 $(call Package
/openssl
/Default
/description
)
119 This package contains the OpenSSL command-line utility.
122 define Package
/libopenssl-conf
123 $(call Package
/openssl
/Default
)
125 TITLE
:=/etc
/ssl
/openssl.cnf config file
129 define Package
/libopenssl-conf
/conffiles
133 define Package
/libopenssl-conf
/description
134 $(call Package
/openssl
/Default
/description
)
135 This package installs the OpenSSL configuration file
/etc
/ssl
/openssl.cnf.
138 define Package
/libopenssl-afalg
139 $(call Package
/openssl
/Default
)
141 TITLE
:=AFALG hardware acceleration engine
142 DEPENDS
:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO \
143 +PACKAGE_libopenssl-afalg
:kmod-crypto-user
+libopenssl-conf @
!OPENSSL_ENGINE_BUILTIN
146 define Package
/libopenssl-afalg
/description
147 This package adds an engine that enables hardware acceleration
148 through the AF_ALG kernel interface.
149 To use it
, you need to configure the engine in
/etc
/ssl
/openssl.cnf
150 See https
://www.openssl.org
/docs
/man1.1
.1/man5
/config.html
#Engine-Configuration-Module
151 and https
://openwrt.org
/docs
/techref
/hardware
/cryptographic.hardware.accelerators
152 The engine_id is
"afalg"
155 define Package
/libopenssl-devcrypto
156 $(call Package
/openssl
/Default
)
158 TITLE
:=/dev
/crypto hardware acceleration engine
159 DEPENDS
:=libopenssl @OPENSSL_ENGINE
+PACKAGE_libopenssl-devcrypto
:kmod-cryptodev
+libopenssl-conf \
160 @
!OPENSSL_ENGINE_BUILTIN
163 define Package
/libopenssl-devcrypto
/description
164 This package adds an engine that enables hardware acceleration
165 through the
/dev
/crypto kernel interface.
166 To use it
, you need to configure the engine in
/etc
/ssl
/openssl.cnf
167 See https
://www.openssl.org
/docs
/man1.1
.1/man5
/config.html
#Engine-Configuration-Module
168 and https
://openwrt.org
/docs
/techref
/hardware
/cryptographic.hardware.accelerators
169 The engine_id is
"devcrypto"
172 define Package
/libopenssl-padlock
173 $(call Package
/openssl
/Default
)
175 TITLE
:=VIA Padlock hardware acceleration engine
176 DEPENDS
:=libopenssl @OPENSSL_ENGINE @TARGET_x86
+PACKAGE_libopenssl-padlock
:kmod-crypto-hw-padlock \
177 +libopenssl-conf @
!OPENSSL_ENGINE_BUILTIN
180 define Package
/libopenssl-padlock
/description
181 This package adds an engine that enables VIA Padlock hardware acceleration.
182 To use it
, you need to configure it in
/etc
/ssl
/openssl.cnf.
183 See https
://www.openssl.org
/docs
/man1.1
.1/man5
/config.html
#Engine-Configuration-Module
184 and https
://openwrt.org
/docs
/techref
/hardware
/cryptographic.hardware.accelerators
185 The engine_id is
"padlock"
188 OPENSSL_OPTIONS
:= shared
190 ifndef CONFIG_OPENSSL_WITH_BLAKE2
191 OPENSSL_OPTIONS
+= no-blake2
194 ifndef CONFIG_OPENSSL_WITH_CHACHA_POLY1305
195 OPENSSL_OPTIONS
+= no-chacha no-poly1305
197 ifdef CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM
198 OPENSSL_OPTIONS
+= -DOPENSSL_PREFER_CHACHA_OVER_GCM
202 ifndef CONFIG_OPENSSL_WITH_ASYNC
203 OPENSSL_OPTIONS
+= no-async
206 ifndef CONFIG_OPENSSL_WITH_EC2M
207 OPENSSL_OPTIONS
+= no-ec2m
210 ifndef CONFIG_OPENSSL_WITH_ERROR_MESSAGES
211 OPENSSL_OPTIONS
+= no-err
214 ifndef CONFIG_OPENSSL_WITH_TLS13
215 OPENSSL_OPTIONS
+= no-tls1_3
218 ifndef CONFIG_OPENSSL_WITH_ARIA
219 OPENSSL_OPTIONS
+= no-aria
222 ifndef CONFIG_OPENSSL_WITH_SM234
223 OPENSSL_OPTIONS
+= no-sm2 no-sm3 no-sm4
226 ifndef CONFIG_OPENSSL_WITH_CAMELLIA
227 OPENSSL_OPTIONS
+= no-camellia
230 ifndef CONFIG_OPENSSL_WITH_IDEA
231 OPENSSL_OPTIONS
+= no-idea
234 ifndef CONFIG_OPENSSL_WITH_SEED
235 OPENSSL_OPTIONS
+= no-seed
238 ifndef CONFIG_OPENSSL_WITH_MDC2
239 OPENSSL_OPTIONS
+= no-mdc2
242 ifndef CONFIG_OPENSSL_WITH_WHIRLPOOL
243 OPENSSL_OPTIONS
+= no-whirlpool
246 ifndef CONFIG_OPENSSL_WITH_CMS
247 OPENSSL_OPTIONS
+= no-cms
250 ifndef CONFIG_OPENSSL_WITH_RFC3779
251 OPENSSL_OPTIONS
+= no-rfc3779
254 ifdef CONFIG_OPENSSL_NO_DEPRECATED
255 OPENSSL_OPTIONS
+= no-deprecated
258 ifeq ($(CONFIG_OPENSSL_OPTIMIZE_SPEED
),y
)
259 TARGET_CFLAGS
:= $(filter-out -O
%,$(TARGET_CFLAGS
)) -O3
261 OPENSSL_OPTIONS
+= -DOPENSSL_SMALL_FOOTPRINT
264 ifdef CONFIG_OPENSSL_ENGINE
265 ifdef CONFIG_OPENSSL_ENGINE_BUILTIN
266 OPENSSL_OPTIONS
+= disable-dynamic-engine
267 ifndef CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG
268 OPENSSL_OPTIONS
+= no-afalgeng
270 ifdef CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO
271 OPENSSL_OPTIONS
+= enable-devcryptoeng
273 ifndef CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK
274 OPENSSL_OPTIONS
+= no-hw-padlock
277 ifdef CONFIG_PACKAGE_libopenssl-devcrypto
278 OPENSSL_OPTIONS
+= enable-devcryptoeng
280 ifndef CONFIG_PACKAGE_libopenssl-afalg
281 OPENSSL_OPTIONS
+= no-afalgeng
283 ifndef CONFIG_PACKAGE_libopenssl-padlock
284 OPENSSL_OPTIONS
+= no-hw-padlock
288 OPENSSL_OPTIONS
+= no-engine
291 ifndef CONFIG_OPENSSL_WITH_DTLS
292 OPENSSL_OPTIONS
+= no-dtls
295 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
296 OPENSSL_OPTIONS
+= zlib-dynamic
298 OPENSSL_OPTIONS
+= no-comp
301 ifndef CONFIG_OPENSSL_WITH_NPN
302 OPENSSL_OPTIONS
+= no-nextprotoneg
305 ifndef CONFIG_OPENSSL_WITH_PSK
306 OPENSSL_OPTIONS
+= no-psk
309 ifndef CONFIG_OPENSSL_WITH_SRP
310 OPENSSL_OPTIONS
+= no-srp
313 ifndef CONFIG_OPENSSL_WITH_ASM
314 OPENSSL_OPTIONS
+= no-asm
318 ifndef CONFIG_OPENSSL_WITH_SSE2
319 OPENSSL_OPTIONS
+= no-sse2
323 OPENSSL_TARGET
:=linux-
$(call qstrip
,$(CONFIG_ARCH
))-openwrt
325 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(shell echo
$(OPENSSL_OPTIONS
) |
$(MKHASH
) md5
)
327 define Build
/Configure
328 (cd
$(PKG_BUILD_DIR
); \
329 .
/Configure
$(OPENSSL_TARGET
) \
332 --openssldir
=/etc
/ssl \
333 --cross-compile-prefix
="$(TARGET_CROSS)" \
336 $(OPENSSL_OPTIONS
) && \
337 { [ -f
$(STAMP_CONFIGURED
) ] || make
clean; } \
341 TARGET_CFLAGS
+= $(FPIC
) -ffunction-sections
-fdata-sections
342 TARGET_LDFLAGS
+= -Wl
,--gc-sections
345 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
347 SOURCE_DATE_EPOCH
=$(SOURCE_DATE_EPOCH
) \
348 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
349 $(OPENSSL_MAKEFLAGS
) \
351 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
353 DESTDIR
="$(PKG_INSTALL_DIR)" \
354 $(OPENSSL_MAKEFLAGS
) \
355 install_sw install_ssldirs
358 define Build
/InstallDev
359 $(INSTALL_DIR
) $(1)/usr
/include
360 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
361 $(INSTALL_DIR
) $(1)/usr
/lib
/
362 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
363 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
364 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
365 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
368 define Package
/libopenssl
/install
369 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
370 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
371 chmod
0700 $(1)/etc
/ssl
/private
372 $(INSTALL_DIR
) $(1)/usr
/lib
373 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
374 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
375 $(if
$(CONFIG_OPENSSL_ENGINE
),$(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
))
378 define Package
/libopenssl-conf
/install
379 $(INSTALL_DIR
) $(1)/etc
/ssl
380 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
383 define Package
/openssl-util
/install
384 $(INSTALL_DIR
) $(1)/usr
/bin
385 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
388 define Package
/libopenssl-afalg
/install
389 $(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
)
390 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/$(ENGINES_DIR
)/afalg.so
$(1)/usr
/lib
/$(ENGINES_DIR
)
393 define Package
/libopenssl-devcrypto
/install
394 $(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
)
395 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/$(ENGINES_DIR
)/devcrypto.so
$(1)/usr
/lib
/$(ENGINES_DIR
)
398 define Package
/libopenssl-padlock
/install
399 $(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
)
400 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/$(ENGINES_DIR
)/*padlock.so
$(1)/usr
/lib
/$(ENGINES_DIR
)
403 $(eval
$(call BuildPackage
,libopenssl
))
404 $(eval
$(call BuildPackage
,libopenssl-conf
))
405 $(eval
$(call BuildPackage
,libopenssl-afalg
))
406 $(eval
$(call BuildPackage
,libopenssl-devcrypto
))
407 $(eval
$(call BuildPackage
,libopenssl-padlock
))
408 $(eval
$(call BuildPackage
,openssl-util
))