c99c538635bdcb2264dec5ee979f64bb665c4379
[openwrt/openwrt.git] / package / boot / uboot-mxs / patches / 002-tools-mxsimage-Support-building-with-LibreSSL.patch
1 From 74e3ace3495b73f6e592e92eca18175cccdb5a24 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 17 Feb 2018 15:34:19 +0100
4 Subject: [PATCH v2] tools/mxsimage: Support building with LibreSSL
5
6 The mxsimage utility fails to compile against LibreSSL because LibreSSL
7 says it is OpenSSL 2.0, but it does not support the complete OpenSSL 1.1
8 interface.
9
10 LibreSSL defines OPENSSL_VERSION_NUMBER with 0x20000000L and therefor
11 claims to have an API compatible with OpenSSL 2.0, but it does not
12 implement OPENSSL_zalloc() and some other functions in its most recent
13 version. OpenSSL implements this function since version 1.1.0.
14
15 This commit will activate the compatibility code meant for
16 OpenSSL < 1.1.0 also for all versions of LibreSSL, if some version of
17 LibreSSL will support these functions in the future the version check
18 should be adapted.
19
20 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
21 ---
22 tools/mxsimage.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25 --- a/tools/mxsimage.c
26 +++ b/tools/mxsimage.c
27 @@ -26,7 +26,7 @@
28 * OpenSSL 1.1.0 and newer compatibility functions:
29 * https://wiki.openssl.org/index.php/1.1_API_Changes
30 */
31 -#if OPENSSL_VERSION_NUMBER < 0x10100000L
32 +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
33 static void *OPENSSL_zalloc(size_t num)
34 {
35 void *ret = OPENSSL_malloc(num);