strongswan: fix compilation against updated WolfSSL 5.6.3
authorJo-Philipp Wich <jo@mein.io>
Fri, 25 Aug 2023 08:41:59 +0000 (10:41 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 25 Aug 2023 08:46:44 +0000 (10:46 +0200)
After OpenWrt base updated WolfSSL to version 5.6.3, the strongswan wolfssl
plugin fails to compile due to a header conflict.

The error reported by the builders is:

    In file included from .../usr/include/wolfssl/openssl/asn1.h:27,
                     from .../usr/include/wolfssl/ssl.h:4123,
                     from wolfssl_common.h:64,
                     from wolfssl_ec_private_key.c:23:
    ../../../../src/libstrongswan/asn1/asn1.h:43:9: error: 'WOLFSSL_ASN1_STRING' redeclared as different kind of symbol
       43 |         ASN1_UTF8STRING =               0x0C,
          |         ^~~~~~~~~~~~~~~
    In file included from wolfssl_common.h:64,
                     from wolfssl_ec_private_key.c:23:
    .../usr/include/wolfssl/ssl.h:212:41: note: previous declaration of 'WOLFSSL_ASN1_STRING' with type 'WOLFSSL_ASN1_STRING'
      212 | typedef struct WOLFSSL_ASN1_STRING      WOLFSSL_ASN1_STRING;
          |                                         ^~~~~~~~~~~~~~~~~~~
    make[9]: *** [Makefile:621: wolfssl_ec_private_key.lo] Error 1

Solve this issue by adding a local path that remaps `ASN1_UTF8STRING`
during wolfssl header inclusion, like it is done already for other
conflicting defines.

Ref: https://forum.openwrt.org/t/x/169580
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
net/strongswan/Makefile
net/strongswan/patches/1000-wolfssl-prevent-header-conflicts.patch [new file with mode: 0644]

index f0c08439c16fe8142daf0daf89a93338ae204348..e1e9e55c0f420c1708dcb20aab22a3b2678b421a 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=strongswan
 PKG_VERSION:=5.9.5
-PKG_RELEASE:=13
+PKG_RELEASE:=13.1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://download.strongswan.org/ https://download2.strongswan.org/
diff --git a/net/strongswan/patches/1000-wolfssl-prevent-header-conflicts.patch b/net/strongswan/patches/1000-wolfssl-prevent-header-conflicts.patch
new file mode 100644 (file)
index 0000000..80cba90
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/src/libstrongswan/plugins/wolfssl/wolfssl_common.h
++++ b/src/libstrongswan/plugins/wolfssl/wolfssl_common.h
+@@ -57,6 +57,7 @@
+ #define ASN1_OCTET_STRING    REMAP_ASN1_OCTET_STRING
+ #define ASN1_UTCTIME         REMAP_ASN1_UTCTIME
+ #define ASN1_GENERALIZEDTIME REMAP_ASN1_GENERALIZEDTIME
++#define ASN1_UTF8STRING      REMAP_ASN1_UTF8STRING
+ #ifndef WOLFSSL_USER_SETTINGS
+       #include <wolfssl/options.h>
+@@ -91,6 +92,7 @@ typedef union {
+ #undef ASN1_OCTET_STRING
+ #undef ASN1_UTCTIME
+ #undef ASN1_GENERALIZEDTIME
++#undef ASN1_UTF8STRING
+ /* Eliminate macro conflicts */
+ #undef RNG