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
)
18 PKG_BUILD_DEPENDS
:=cryptodev-linux
20 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
22 http
://ftp.fi.muni.cz
/pub
/openssl
/source
/ \
23 http
://ftp.linux.hr
/pub
/openssl
/source
/ \
24 ftp
://ftp.pca.dfn.de
/pub
/tools
/net
/openssl
/source
/ \
25 http
://www.openssl.org
/source
/ \
26 http
://www.openssl.org
/source
/old
/$(PKG_BASE
)/
27 PKG_HASH
:=5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684
31 PKG_LICENSE_FILES
:=LICENSE
32 PKG_CPE_ID
:=cpe
:/a
:openssl
:openssl
33 PKG_CONFIG_DEPENDS
:= \
34 CONFIG_OPENSSL_ENGINE \
35 CONFIG_OPENSSL_ENGINE_CRYPTO \
36 CONFIG_OPENSSL_ENGINE_DIGEST \
37 CONFIG_OPENSSL_NO_DEPRECATED \
38 CONFIG_OPENSSL_OPTIMIZE_SPEED \
39 CONFIG_OPENSSL_WITH_ASM \
40 CONFIG_OPENSSL_WITH_CAMELLIA \
41 CONFIG_OPENSSL_WITH_CMS \
42 CONFIG_OPENSSL_WITH_COMPRESSION \
43 CONFIG_OPENSSL_WITH_DTLS \
44 CONFIG_OPENSSL_WITH_EC \
45 CONFIG_OPENSSL_WITH_EC2M \
46 CONFIG_OPENSSL_WITH_ERROR_MESSAGES \
47 CONFIG_OPENSSL_WITH_GOST \
48 CONFIG_OPENSSL_WITH_IDEA \
49 CONFIG_OPENSSL_WITH_MDC2 \
50 CONFIG_OPENSSL_WITH_NPN \
51 CONFIG_OPENSSL_WITH_PSK \
52 CONFIG_OPENSSL_WITH_RFC3779 \
53 CONFIG_OPENSSL_WITH_SEED \
54 CONFIG_OPENSSL_WITH_SRP \
55 CONFIG_OPENSSL_WITH_SSE2 \
56 CONFIG_OPENSSL_WITH_WHIRLPOOL
58 include $(INCLUDE_DIR
)/package.mk
60 ifneq ($(CONFIG_CCACHE
),)
61 HOSTCC
=$(HOSTCC_NOCACHE
)
62 HOSTCXX
=$(HOSTCXX_NOCACHE
)
65 define Package
/openssl
/Default
66 TITLE
:=Open source SSL toolkit
67 URL
:=http
://www.openssl.org
/
72 define Package
/libopenssl
/config
73 source
"$(SOURCE)/Config.in"
76 define Package
/openssl
/Default
/description
77 The OpenSSL Project is a collaborative effort to develop a robust
,
78 commercial-grade
, full-featured
, and Open Source toolkit implementing the
79 Transport Layer Security
(TLS
) protocol
as well
as a full-strength
80 general-purpose cryptography library.
83 define Package
/libopenssl
84 $(call Package
/openssl
/Default
)
86 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
92 define Package
/libopenssl
/description
93 $(call Package
/openssl
/Default
/description
)
94 This package contains the OpenSSL shared libraries
, needed by other programs.
97 define Package
/openssl-util
98 $(call Package
/openssl
/Default
)
105 define Package
/openssl-util
/conffiles
109 define Package
/openssl-util
/description
110 $(call Package
/openssl
/Default
/description
)
111 This package contains the OpenSSL command-line utility.
114 define Package
/libopenssl-gost
115 $(call Package
/openssl
/Default
)
117 TITLE
:=Russian GOST algorithms engine
118 DEPENDS
:=libopenssl
+@OPENSSL_WITH_GOST
121 define Package
/libopenssl-gost
/description
122 This package adds an engine that enables Russian GOST algorithms.
123 To use it
, you need to configure the engine in
/etc
/ssl
/openssl.cnf
124 See https
://www.openssl.org
/docs
/man1.0
.2/apps
/config.html
#ENGINE-CONFIGURATION-MODULE
125 The engine_id is
"gost"
128 define Package
/libopenssl-padlock
129 $(call Package
/openssl
/Default
)
131 TITLE
:=VIA Padlock hardware acceleration engine
132 DEPENDS
:=libopenssl @OPENSSL_ENGINE @TARGET_x86
+kmod-crypto-hw-padlock
135 define Package
/libopenssl-padlock
/description
136 This package adds an engine that enables VIA Padlock hardware acceleration.
137 To use it
, you need to configure it in
/etc
/ssl
/openssl.cnf.
138 See https
://www.openssl.org
/docs
/man1.0
.2/apps
/config.html
#ENGINE-CONFIGURATION-MODULE
139 The engine_id is
"padlock"
142 OPENSSL_OPTIONS
:= shared no-heartbeats no-sha0 no-ssl2-method no-ssl3-method
144 ifndef CONFIG_OPENSSL_WITH_EC
145 OPENSSL_OPTIONS
+= no-ec
148 ifndef CONFIG_OPENSSL_WITH_EC2M
149 OPENSSL_OPTIONS
+= no-ec2m
152 ifndef CONFIG_OPENSSL_WITH_ERROR_MESSAGES
153 OPENSSL_OPTIONS
+= no-err
156 ifndef CONFIG_OPENSSL_WITH_CAMELLIA
157 OPENSSL_OPTIONS
+= no-camellia
160 ifndef CONFIG_OPENSSL_WITH_IDEA
161 OPENSSL_OPTIONS
+= no-idea
164 ifndef CONFIG_OPENSSL_WITH_SEED
165 OPENSSL_OPTIONS
+= no-seed
168 ifndef CONFIG_OPENSSL_WITH_MDC2
169 OPENSSL_OPTIONS
+= no-mdc2
172 ifndef CONFIG_OPENSSL_WITH_WHIRLPOOL
173 OPENSSL_OPTIONS
+= no-whirlpool
176 ifndef CONFIG_OPENSSL_WITH_CMS
177 OPENSSL_OPTIONS
+= no-cms
180 ifdef CONFIG_OPENSSL_WITH_RFC3779
181 OPENSSL_OPTIONS
+= enable-rfc3779
184 ifdef CONFIG_OPENSSL_NO_DEPRECATED
185 OPENSSL_OPTIONS
+= no-deprecated
188 ifeq ($(CONFIG_OPENSSL_OPTIMIZE_SPEED
),y
)
189 TARGET_CFLAGS
:= $(filter-out -O
%,$(TARGET_CFLAGS
)) -O3
191 OPENSSL_OPTIONS
+= -DOPENSSL_SMALL_FOOTPRINT
194 ifdef CONFIG_OPENSSL_ENGINE
195 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
196 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
197 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
198 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
201 ifndef CONFIG_PACKAGE_libopenssl-padlock
202 OPENSSL_OPTIONS
+= no-hw-padlock
205 OPENSSL_OPTIONS
+= no-engine
208 ifndef CONFIG_OPENSSL_WITH_GOST
209 OPENSSL_OPTIONS
+= no-gost
212 # Even with no-dtls and no-dtls1 options, the library keeps the DTLS code,
213 # but openssl util gets built without it
214 ifndef CONFIG_OPENSSL_WITH_DTLS
215 OPENSSL_OPTIONS
+= no-dtls no-dtls1
218 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
219 OPENSSL_OPTIONS
+= zlib-dynamic
221 OPENSSL_OPTIONS
+= no-comp
224 ifndef CONFIG_OPENSSL_WITH_NPN
225 OPENSSL_OPTIONS
+= no-nextprotoneg
228 ifndef CONFIG_OPENSSL_WITH_PSK
229 OPENSSL_OPTIONS
+= no-psk
232 ifndef CONFIG_OPENSSL_WITH_SRP
233 OPENSSL_OPTIONS
+= no-srp
236 ifndef CONFIG_OPENSSL_WITH_ASM
237 OPENSSL_OPTIONS
+= no-asm
241 ifndef CONFIG_OPENSSL_WITH_SSE2
242 OPENSSL_OPTIONS
+= no-sse2
246 OPENSSL_TARGET
:=linux-
$(call qstrip
,$(CONFIG_ARCH
))-openwrt
248 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(shell echo
$(OPENSSL_OPTIONS
) | mkhash md5
)
250 define Build
/Configure
251 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
252 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
253 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
255 (cd
$(PKG_BUILD_DIR
); \
256 .
/Configure
$(OPENSSL_TARGET
) \
259 --openssldir
=/etc
/ssl \
264 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
265 CROSS_COMPILE
="$(TARGET_CROSS)" \
266 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
267 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
268 $(OPENSSL_MAKEFLAGS
) \
272 TARGET_CFLAGS
+= $(FPIC
) -ffunction-sections
-fdata-sections
273 TARGET_LDFLAGS
+= -Wl
,--gc-sections
276 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
277 CROSS_COMPILE
="$(TARGET_CROSS)" \
279 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
280 AR
="$(TARGET_CROSS)ar r" \
281 RANLIB
="$(TARGET_CROSS)ranlib" \
282 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
283 $(OPENSSL_MAKEFLAGS
) \
285 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
286 CROSS_COMPILE
="$(TARGET_CROSS)" \
288 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
289 AR
="$(TARGET_CROSS)ar r" \
290 RANLIB
="$(TARGET_CROSS)ranlib" \
291 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
292 $(OPENSSL_MAKEFLAGS
) \
294 # Work around openssl build bug to link libssl.so with libcrypto.so.
295 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
296 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
297 CROSS_COMPILE
="$(TARGET_CROSS)" \
299 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
300 $(OPENSSL_MAKEFLAGS
) \
302 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
303 CROSS_COMPILE
="$(TARGET_CROSS)" \
305 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
306 $(OPENSSL_MAKEFLAGS
) \
310 define Build
/InstallDev
311 $(INSTALL_DIR
) $(1)/usr
/include
312 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
313 $(INSTALL_DIR
) $(1)/usr
/lib
/
314 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
315 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
316 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
317 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
320 define Package
/libopenssl
/install
321 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
322 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
323 chmod
0700 $(1)/etc
/ssl
/private
324 $(INSTALL_DIR
) $(1)/usr
/lib
325 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
326 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
327 $(if
$(CONFIG_OPENSSL_ENGINE
),$(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
))
330 define Package
/openssl-util
/install
331 $(INSTALL_DIR
) $(1)/etc
/ssl
332 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
333 $(INSTALL_DIR
) $(1)/usr
/bin
334 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
337 define Package
/libopenssl-padlock
/install
338 $(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
)
339 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/$(ENGINES_DIR
)/*padlock.so
$(1)/usr
/lib
/$(ENGINES_DIR
)
342 define Package
/libopenssl-gost
/install
343 $(INSTALL_DIR
) $(1)/usr
/lib
/$(ENGINES_DIR
)
344 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/$(ENGINES_DIR
)/libgost.so
$(1)/usr
/lib
/$(ENGINES_DIR
)
347 $(eval
$(call BuildPackage
,libopenssl
))
348 $(eval
$(call BuildPackage
,libopenssl-gost
))
349 $(eval
$(call BuildPackage
,libopenssl-padlock
))
350 $(eval
$(call BuildPackage
,openssl-util
))