strongswan: Backport upstream fix for RNG definition conflict
[feed/packages.git] / net / strongswan / patches / 0003-undef-wolfssl-RNG.patch
1 commit 5226561a77efc94b53d708a855df267b11f53b83
2 Author: Philip Prindeville <philipp@redfish-solutions.com>
3 Date: Wed Mar 27 17:41:18 2024 -0600
4
5 wolfssl: avoid RNG redefinition
6
7 There are definitions of RNG in <wolfcrypt/settings.h> and
8 <wolfcrypt/random.h> that play havoc with the literal RNG being
9 used in the expansions of _PLUGIN_FEATURE_RNG() => __PLUGIN_FEATURE()
10 in <plugins/plugin_feature.h> when ##-concatenated to build the
11 enum FEATURE_RNG.
12
13 <plugins/plugin_feature.h> must always be included before
14 <woldssl/ssl.h>, and RNG must be undefined before any plugins are
15 declared.
16
17 Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
18
19 --- a/src/libstrongswan/plugins/wolfssl/wolfssl_common.h
20 +++ b/src/libstrongswan/plugins/wolfssl/wolfssl_common.h
21 @@ -80,7 +80,4 @@ typedef union {
22
23 #undef PARSE_ERROR
24
25 -/* Eliminate macro conflicts */
26 -#undef RNG
27 -
28 #endif /* WOLFSSL_PLUGIN_COMMON_H_ */
29 --- a/src/libstrongswan/plugins/wolfssl/wolfssl_plugin.c
30 +++ b/src/libstrongswan/plugins/wolfssl/wolfssl_plugin.c
31 @@ -47,6 +47,8 @@
32
33 #include <wolfssl/ssl.h>
34
35 +#undef RNG
36 +
37 #ifndef FIPS_MODE
38 #define FIPS_MODE 0
39 #endif