diff mbox series

[LEDE-DEV] uboot-mxs: fix compile problems related to OpenSSL

Message ID 20180316180510.6304-1-hauke@hauke-m.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [LEDE-DEV] uboot-mxs: fix compile problems related to OpenSSL | expand

Commit Message

Hauke Mehrtens March 16, 2018, 6:05 p.m. UTC
Use the UBOOT_MAKE_FLAGS defined in include/u-boot.mk and do not
overwrite them to compile the host tools against the shipped LibreSSL.
In addition add a patch to fix a compile problem when compiling the
tools against LibreSSL caused by differences in the API between OpenSSL
1.1 and LibreSSL.

This should fix the compile problems seen in build bot from time to time
by not depending on the host libssl-dev package any more but using the
LibreSSL version from OpenWrt.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 package/boot/uboot-mxs/Makefile                    |  2 +-
 .../uboot-mxs/patches/001-add-i2se-duckbill.patch  | 26 ----------------------
 ...s-mxsimage-Support-building-with-LibreSSL.patch | 25 +++++++++++++++++++++
 3 files changed, 26 insertions(+), 27 deletions(-)
 create mode 100644 package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch

Comments

Michael Heimpold March 17, 2018, 11:34 a.m. UTC | #1
Hi Hauke,

some comments below.

Am Freitag, 16. März 2018, 19:05:10 CET schrieb Hauke Mehrtens:
> Use the UBOOT_MAKE_FLAGS defined in include/u-boot.mk and do not
> overwrite them to compile the host tools against the shipped LibreSSL.
> In addition add a patch to fix a compile problem when compiling the
> tools against LibreSSL caused by differences in the API between OpenSSL
> 1.1 and LibreSSL.
> 
> This should fix the compile problems seen in build bot from time to time
> by not depending on the host libssl-dev package any more but using the
> LibreSSL version from OpenWrt.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  package/boot/uboot-mxs/Makefile                    |  2 +-
>  .../uboot-mxs/patches/001-add-i2se-duckbill.patch  | 26 ----------------------

Changes in this file are not related to the patch description and this makes
it hard to review your intended changes. Is it possible to re-submit a version
without touching this file at all? I would really appreciate this.

>  ...s-mxsimage-Support-building-with-LibreSSL.patch | 25 +++++++++++++++++++++
>  3 files changed, 26 insertions(+), 27 deletions(-)
>  create mode 100644 package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
> 
> diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile
> index 6fde52ef56..cd752bb81a 100644
> --- a/package/boot/uboot-mxs/Makefile
> +++ b/package/boot/uboot-mxs/Makefile
> @@ -35,7 +35,7 @@ UBOOT_TARGETS := \
>  	mx23_olinuxino \
>  	duckbill
>  
> -UBOOT_MAKE_FLAGS = $(UBOOT_IMAGE)
> +UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE)
>  
>  define Build/InstallDev
>  	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
> diff --git a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
> index 15217b57ee..1ad67fbba8 100644
> --- a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
> +++ b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
> @@ -43,8 +43,6 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>   create mode 100644 configs/duckbill_defconfig
>   create mode 100644 include/configs/duckbill.h
>  
> -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> -index 30e71b2..b77e778 100644
>  --- a/arch/arm/Kconfig
>  +++ b/arch/arm/Kconfig
>  @@ -373,6 +373,12 @@ config TARGET_MX28EVK
> @@ -77,9 +75,6 @@ index 30e71b2..b77e778 100644
>           default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
>   	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
>   
> -diff --git a/board/i2se/duckbill/Kconfig b/board/i2se/duckbill/Kconfig
> -new file mode 100644
> -index 0000000..98c1e46
>  --- /dev/null
>  +++ b/board/i2se/duckbill/Kconfig
>  @@ -0,0 +1,15 @@
> @@ -98,9 +93,6 @@ index 0000000..98c1e46
>  +	default "duckbill"
>  +
>  +endif
> -diff --git a/board/i2se/duckbill/MAINTAINERS b/board/i2se/duckbill/MAINTAINERS
> -new file mode 100644
> -index 0000000..5496baa
>  --- /dev/null
>  +++ b/board/i2se/duckbill/MAINTAINERS
>  @@ -0,0 +1,6 @@
> @@ -110,9 +102,6 @@ index 0000000..5496baa
>  +F:	board/i2se/duckbill/
>  +F:	include/configs/duckbill.h
>  +F:	configs/duckbill_defconfig
> -diff --git a/board/i2se/duckbill/Makefile b/board/i2se/duckbill/Makefile
> -new file mode 100644
> -index 0000000..66baec4
>  --- /dev/null
>  +++ b/board/i2se/duckbill/Makefile
>  @@ -0,0 +1,12 @@
> @@ -128,9 +117,6 @@ index 0000000..66baec4
>  +else
>  +obj-y	:= iomux.o
>  +endif
> -diff --git a/board/i2se/duckbill/duckbill.c b/board/i2se/duckbill/duckbill.c
> -new file mode 100644
> -index 0000000..caeb903
>  --- /dev/null
>  +++ b/board/i2se/duckbill/duckbill.c
>  @@ -0,0 +1,181 @@
> @@ -315,9 +301,6 @@ index 0000000..caeb903
>  +
>  +	return 0;
>  +}
> -diff --git a/board/i2se/duckbill/iomux.c b/board/i2se/duckbill/iomux.c
> -new file mode 100644
> -index 0000000..b3c4d92
>  --- /dev/null
>  +++ b/board/i2se/duckbill/iomux.c
>  @@ -0,0 +1,157 @@
> @@ -478,9 +461,6 @@ index 0000000..b3c4d92
>  +	else
>  +		mxs_iomux_setup_multiple_pads(iomux_setup_v1, ARRAY_SIZE(iomux_setup_v1));
>  +}
> -diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig
> -new file mode 100644
> -index 0000000..2adce92
>  --- /dev/null
>  +++ b/configs/duckbill_defconfig
>  @@ -0,0 +1,31 @@
> @@ -515,9 +495,6 @@ index 0000000..2adce92
>  +CONFIG_ENV_IS_IN_MMC=y
>  +CONFIG_MMC_MXS=y
>  +CONFIG_OF_LIBFDT=y
> -diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h
> -new file mode 100644
> -index 0000000..f9374c6
>  --- /dev/null
>  +++ b/include/configs/duckbill.h
>  @@ -0,0 +1,199 @@
> @@ -720,6 +697,3 @@ index 0000000..f9374c6
>  +#include <configs/mxs.h>
>  +
>  +#endif /* __CONFIGS_DUCKBILL_H__ */
> --- 
> -2.7.4
> -
> diff --git a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
> new file mode 100644
> index 0000000000..1870fd094e
> --- /dev/null
> +++ b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
> @@ -0,0 +1,25 @@
> +From 461e8174de320dac1aee1c1b61a9f0f5cfc38a00 Mon Sep 17 00:00:00 2001
> +From: Hauke Mehrtens <hauke@hauke-m.de>
> +Date: Sat, 17 Feb 2018 15:34:19 +0100
> +Subject: [PATCH] tools/mxsimage: Support building with LibreSSL
> +
> +The mxsimage utility fails to compile against LibreSSL because LibreSSL
> +says it is OpenSSL 2.0, but it does not support the complete OpenSSL 1.1
> +interface.
> +
> +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> +---
> + tools/mxsimage.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +--- a/tools/mxsimage.c
> ++++ b/tools/mxsimage.c
> +@@ -26,7 +26,7 @@
> +  * OpenSSL 1.1.0 and newer compatibility functions:
> +  * https://wiki.openssl.org/index.php/1.1_API_Changes
> +  */
> +-#if OPENSSL_VERSION_NUMBER < 0x10100000L
> ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
> + static void *OPENSSL_zalloc(size_t num)
> + {
> + 	void *ret = OPENSSL_malloc(num);
> 

Are you going to submit this patch upstream?  This would be great...

Apart from the comments above, I tested this and it worked for me on my local
machine, so:

Tested-by: Michael Heimpold <mhei@heimpold.de>

Regards,
mhei
Hauke Mehrtens March 17, 2018, 1:17 p.m. UTC | #2
On 03/17/2018 12:34 PM, Michael Heimpold wrote:
> Hi Hauke,
> 
> some comments below.
> 
> Am Freitag, 16. März 2018, 19:05:10 CET schrieb Hauke Mehrtens:
>> Use the UBOOT_MAKE_FLAGS defined in include/u-boot.mk and do not
>> overwrite them to compile the host tools against the shipped LibreSSL.
>> In addition add a patch to fix a compile problem when compiling the
>> tools against LibreSSL caused by differences in the API between OpenSSL
>> 1.1 and LibreSSL.
>>
>> This should fix the compile problems seen in build bot from time to time
>> by not depending on the host libssl-dev package any more but using the
>> LibreSSL version from OpenWrt.
>>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  package/boot/uboot-mxs/Makefile                    |  2 +-
>>  .../uboot-mxs/patches/001-add-i2se-duckbill.patch  | 26 ----------------------
> 
> Changes in this file are not related to the patch description and this makes
> it hard to review your intended changes. Is it possible to re-submit a version
> without touching this file at all? I would really appreciate this.

I will do this in an extra patch. I just wanted to refresh my patch but
this was not done for the other patch before.

>>  ...s-mxsimage-Support-building-with-LibreSSL.patch | 25 +++++++++++++++++++++
>>  3 files changed, 26 insertions(+), 27 deletions(-)
>>  create mode 100644 package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
>>
>> diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile
>> index 6fde52ef56..cd752bb81a 100644
>> --- a/package/boot/uboot-mxs/Makefile
>> +++ b/package/boot/uboot-mxs/Makefile
>> @@ -35,7 +35,7 @@ UBOOT_TARGETS := \
>>  	mx23_olinuxino \
>>  	duckbill
>>  
>> -UBOOT_MAKE_FLAGS = $(UBOOT_IMAGE)
>> +UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE)
>>  
>>  define Build/InstallDev
>>  	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
>> diff --git a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
>> index 15217b57ee..1ad67fbba8 100644
>> --- a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
>> +++ b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
>> @@ -43,8 +43,6 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>>   create mode 100644 configs/duckbill_defconfig
>>   create mode 100644 include/configs/duckbill.h
>>  
>> -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> -index 30e71b2..b77e778 100644
>>  --- a/arch/arm/Kconfig
>>  +++ b/arch/arm/Kconfig
>>  @@ -373,6 +373,12 @@ config TARGET_MX28EVK
>> @@ -77,9 +75,6 @@ index 30e71b2..b77e778 100644
>>           default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
>>   	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
>>   
>> -diff --git a/board/i2se/duckbill/Kconfig b/board/i2se/duckbill/Kconfig
>> -new file mode 100644
>> -index 0000000..98c1e46
>>  --- /dev/null
>>  +++ b/board/i2se/duckbill/Kconfig
>>  @@ -0,0 +1,15 @@
>> @@ -98,9 +93,6 @@ index 0000000..98c1e46
>>  +	default "duckbill"
>>  +
>>  +endif
>> -diff --git a/board/i2se/duckbill/MAINTAINERS b/board/i2se/duckbill/MAINTAINERS
>> -new file mode 100644
>> -index 0000000..5496baa
>>  --- /dev/null
>>  +++ b/board/i2se/duckbill/MAINTAINERS
>>  @@ -0,0 +1,6 @@
>> @@ -110,9 +102,6 @@ index 0000000..5496baa
>>  +F:	board/i2se/duckbill/
>>  +F:	include/configs/duckbill.h
>>  +F:	configs/duckbill_defconfig
>> -diff --git a/board/i2se/duckbill/Makefile b/board/i2se/duckbill/Makefile
>> -new file mode 100644
>> -index 0000000..66baec4
>>  --- /dev/null
>>  +++ b/board/i2se/duckbill/Makefile
>>  @@ -0,0 +1,12 @@
>> @@ -128,9 +117,6 @@ index 0000000..66baec4
>>  +else
>>  +obj-y	:= iomux.o
>>  +endif
>> -diff --git a/board/i2se/duckbill/duckbill.c b/board/i2se/duckbill/duckbill.c
>> -new file mode 100644
>> -index 0000000..caeb903
>>  --- /dev/null
>>  +++ b/board/i2se/duckbill/duckbill.c
>>  @@ -0,0 +1,181 @@
>> @@ -315,9 +301,6 @@ index 0000000..caeb903
>>  +
>>  +	return 0;
>>  +}
>> -diff --git a/board/i2se/duckbill/iomux.c b/board/i2se/duckbill/iomux.c
>> -new file mode 100644
>> -index 0000000..b3c4d92
>>  --- /dev/null
>>  +++ b/board/i2se/duckbill/iomux.c
>>  @@ -0,0 +1,157 @@
>> @@ -478,9 +461,6 @@ index 0000000..b3c4d92
>>  +	else
>>  +		mxs_iomux_setup_multiple_pads(iomux_setup_v1, ARRAY_SIZE(iomux_setup_v1));
>>  +}
>> -diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig
>> -new file mode 100644
>> -index 0000000..2adce92
>>  --- /dev/null
>>  +++ b/configs/duckbill_defconfig
>>  @@ -0,0 +1,31 @@
>> @@ -515,9 +495,6 @@ index 0000000..2adce92
>>  +CONFIG_ENV_IS_IN_MMC=y
>>  +CONFIG_MMC_MXS=y
>>  +CONFIG_OF_LIBFDT=y
>> -diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h
>> -new file mode 100644
>> -index 0000000..f9374c6
>>  --- /dev/null
>>  +++ b/include/configs/duckbill.h
>>  @@ -0,0 +1,199 @@
>> @@ -720,6 +697,3 @@ index 0000000..f9374c6
>>  +#include <configs/mxs.h>
>>  +
>>  +#endif /* __CONFIGS_DUCKBILL_H__ */
>> --- 
>> -2.7.4
>> -
>> diff --git a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
>> new file mode 100644
>> index 0000000000..1870fd094e
>> --- /dev/null
>> +++ b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
>> @@ -0,0 +1,25 @@
>> +From 461e8174de320dac1aee1c1b61a9f0f5cfc38a00 Mon Sep 17 00:00:00 2001
>> +From: Hauke Mehrtens <hauke@hauke-m.de>
>> +Date: Sat, 17 Feb 2018 15:34:19 +0100
>> +Subject: [PATCH] tools/mxsimage: Support building with LibreSSL
>> +
>> +The mxsimage utility fails to compile against LibreSSL because LibreSSL
>> +says it is OpenSSL 2.0, but it does not support the complete OpenSSL 1.1
>> +interface.
>> +
>> +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> +---
>> + tools/mxsimage.c | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +--- a/tools/mxsimage.c
>> ++++ b/tools/mxsimage.c
>> +@@ -26,7 +26,7 @@
>> +  * OpenSSL 1.1.0 and newer compatibility functions:
>> +  * https://wiki.openssl.org/index.php/1.1_API_Changes
>> +  */
>> +-#if OPENSSL_VERSION_NUMBER < 0x10100000L
>> ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
>> + static void *OPENSSL_zalloc(size_t num)
>> + {
>> + 	void *ret = OPENSSL_malloc(num);
>>
> 
> Are you going to submit this patch upstream?  This would be great...

I just did it, the mail is waiting mailing list manager approval. I
thought I did this before.

> Apart from the comments above, I tested this and it worked for me on my local
> machine, so:
> 
> Tested-by: Michael Heimpold <mhei@heimpold.de>
> 
> Regards,
> mhei
diff mbox series

Patch

diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile
index 6fde52ef56..cd752bb81a 100644
--- a/package/boot/uboot-mxs/Makefile
+++ b/package/boot/uboot-mxs/Makefile
@@ -35,7 +35,7 @@  UBOOT_TARGETS := \
 	mx23_olinuxino \
 	duckbill
 
-UBOOT_MAKE_FLAGS = $(UBOOT_IMAGE)
+UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE)
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
diff --git a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
index 15217b57ee..1ad67fbba8 100644
--- a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
+++ b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch
@@ -43,8 +43,6 @@  Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
  create mode 100644 configs/duckbill_defconfig
  create mode 100644 include/configs/duckbill.h
 
-diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
-index 30e71b2..b77e778 100644
 --- a/arch/arm/Kconfig
 +++ b/arch/arm/Kconfig
 @@ -373,6 +373,12 @@ config TARGET_MX28EVK
@@ -77,9 +75,6 @@  index 30e71b2..b77e778 100644
          default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
  	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
  
-diff --git a/board/i2se/duckbill/Kconfig b/board/i2se/duckbill/Kconfig
-new file mode 100644
-index 0000000..98c1e46
 --- /dev/null
 +++ b/board/i2se/duckbill/Kconfig
 @@ -0,0 +1,15 @@
@@ -98,9 +93,6 @@  index 0000000..98c1e46
 +	default "duckbill"
 +
 +endif
-diff --git a/board/i2se/duckbill/MAINTAINERS b/board/i2se/duckbill/MAINTAINERS
-new file mode 100644
-index 0000000..5496baa
 --- /dev/null
 +++ b/board/i2se/duckbill/MAINTAINERS
 @@ -0,0 +1,6 @@
@@ -110,9 +102,6 @@  index 0000000..5496baa
 +F:	board/i2se/duckbill/
 +F:	include/configs/duckbill.h
 +F:	configs/duckbill_defconfig
-diff --git a/board/i2se/duckbill/Makefile b/board/i2se/duckbill/Makefile
-new file mode 100644
-index 0000000..66baec4
 --- /dev/null
 +++ b/board/i2se/duckbill/Makefile
 @@ -0,0 +1,12 @@
@@ -128,9 +117,6 @@  index 0000000..66baec4
 +else
 +obj-y	:= iomux.o
 +endif
-diff --git a/board/i2se/duckbill/duckbill.c b/board/i2se/duckbill/duckbill.c
-new file mode 100644
-index 0000000..caeb903
 --- /dev/null
 +++ b/board/i2se/duckbill/duckbill.c
 @@ -0,0 +1,181 @@
@@ -315,9 +301,6 @@  index 0000000..caeb903
 +
 +	return 0;
 +}
-diff --git a/board/i2se/duckbill/iomux.c b/board/i2se/duckbill/iomux.c
-new file mode 100644
-index 0000000..b3c4d92
 --- /dev/null
 +++ b/board/i2se/duckbill/iomux.c
 @@ -0,0 +1,157 @@
@@ -478,9 +461,6 @@  index 0000000..b3c4d92
 +	else
 +		mxs_iomux_setup_multiple_pads(iomux_setup_v1, ARRAY_SIZE(iomux_setup_v1));
 +}
-diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig
-new file mode 100644
-index 0000000..2adce92
 --- /dev/null
 +++ b/configs/duckbill_defconfig
 @@ -0,0 +1,31 @@
@@ -515,9 +495,6 @@  index 0000000..2adce92
 +CONFIG_ENV_IS_IN_MMC=y
 +CONFIG_MMC_MXS=y
 +CONFIG_OF_LIBFDT=y
-diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h
-new file mode 100644
-index 0000000..f9374c6
 --- /dev/null
 +++ b/include/configs/duckbill.h
 @@ -0,0 +1,199 @@
@@ -720,6 +697,3 @@  index 0000000..f9374c6
 +#include <configs/mxs.h>
 +
 +#endif /* __CONFIGS_DUCKBILL_H__ */
--- 
-2.7.4
-
diff --git a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
new file mode 100644
index 0000000000..1870fd094e
--- /dev/null
+++ b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch
@@ -0,0 +1,25 @@ 
+From 461e8174de320dac1aee1c1b61a9f0f5cfc38a00 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 17 Feb 2018 15:34:19 +0100
+Subject: [PATCH] tools/mxsimage: Support building with LibreSSL
+
+The mxsimage utility fails to compile against LibreSSL because LibreSSL
+says it is OpenSSL 2.0, but it does not support the complete OpenSSL 1.1
+interface.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ tools/mxsimage.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/mxsimage.c
++++ b/tools/mxsimage.c
+@@ -26,7 +26,7 @@
+  * OpenSSL 1.1.0 and newer compatibility functions:
+  * https://wiki.openssl.org/index.php/1.1_API_Changes
+  */
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ static void *OPENSSL_zalloc(size_t num)
+ {
+ 	void *ret = OPENSSL_malloc(num);