diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2022-03-31 09:20:37 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-03-30 18:25:51 -0700 |
commit | fe149bbb3689c3ed83eddfec46c9a54e86308cb9 (patch) | |
tree | 86a94675f20b4281be6869a19339504b105b268f /meta-networking | |
parent | f36fe239ad6e34a1aeacc5a3ff8be0ed9646705a (diff) | |
download | meta-openembedded-fe149bbb3689c3ed83eddfec46c9a54e86308cb9.tar.gz |
strongswan: 5.9.4 -> 5.9.5
* Backport a patch to fix the segfault with swanctl:
$ /usr/sbin/charon-systemd &
$ /usr/sbin/swanctl --load-all --noprompt
no files found matching '/etc/swanctl/conf.d/*.conf'
no authorities found, 0 unloaded
no pools found, 0 unloaded
no connections found, 0 unloaded
Segmentation fault
* Drop fix-funtion-parameter.patch and
0001-memory.h-Include-stdint.h-for-uintptr_t.patch as the issues have
been fixed upstream.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r-- | meta-networking/recipes-support/strongswan/files/0001-memory.h-Include-stdint.h-for-uintptr_t.patch | 22 | ||||
-rw-r--r-- | meta-networking/recipes-support/strongswan/files/0001-openssl-Don-t-unload-providers.patch | 92 | ||||
-rw-r--r-- | meta-networking/recipes-support/strongswan/files/fix-funtion-parameter.patch | 99 | ||||
-rw-r--r-- | meta-networking/recipes-support/strongswan/strongswan_5.9.5.bb (renamed from meta-networking/recipes-support/strongswan/strongswan_5.9.4.bb) | 5 |
4 files changed, 94 insertions, 124 deletions
diff --git a/meta-networking/recipes-support/strongswan/files/0001-memory.h-Include-stdint.h-for-uintptr_t.patch b/meta-networking/recipes-support/strongswan/files/0001-memory.h-Include-stdint.h-for-uintptr_t.patch deleted file mode 100644 index 2d17507b1..000000000 --- a/meta-networking/recipes-support/strongswan/files/0001-memory.h-Include-stdint.h-for-uintptr_t.patch +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | From 33a53dc13fd924949a582109b45fedd8d0bed59b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 27 Jun 2017 07:42:11 -0700 | ||
4 | Subject: [PATCH] memory.h: Include stdint.h for uintptr_t | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | |||
8 | --- | ||
9 | src/libstrongswan/utils/utils/memory.h | 2 ++ | ||
10 | 1 file changed, 2 insertions(+) | ||
11 | |||
12 | --- a/src/libstrongswan/utils/utils/memory.h | ||
13 | +++ b/src/libstrongswan/utils/utils/memory.h | ||
14 | @@ -26,6 +26,8 @@ | ||
15 | #include <string.h> | ||
16 | #endif | ||
17 | |||
18 | +#include <stdint.h> | ||
19 | + | ||
20 | /** | ||
21 | * Helper function that compares two binary blobs for equality | ||
22 | */ | ||
diff --git a/meta-networking/recipes-support/strongswan/files/0001-openssl-Don-t-unload-providers.patch b/meta-networking/recipes-support/strongswan/files/0001-openssl-Don-t-unload-providers.patch new file mode 100644 index 000000000..7da48cd2c --- /dev/null +++ b/meta-networking/recipes-support/strongswan/files/0001-openssl-Don-t-unload-providers.patch | |||
@@ -0,0 +1,92 @@ | |||
1 | From 3eecd40cec6415fc033f8d9141ab652047e71524 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tobias Brunner <tobias@strongswan.org> | ||
3 | Date: Wed, 23 Feb 2022 17:29:02 +0100 | ||
4 | Subject: [PATCH] openssl: Don't unload providers | ||
5 | |||
6 | There is a conflict between atexit() handlers registered by OpenSSL and | ||
7 | some executables (e.g. swanctl or pki) to deinitialize libstrongswan. | ||
8 | Because plugins are usually loaded after atexit() has been called, the | ||
9 | handler registered by OpenSSL will run before our handler. So when the | ||
10 | latter destroys the plugins it's a bad idea to try to access any OpenSSL | ||
11 | objects as they might already be invalid. | ||
12 | |||
13 | Fixes: f556fce16b60 ("openssl: Load "legacy" provider in OpenSSL 3 for algorithms like MD4, DES etc.") | ||
14 | Closes strongswan/strongswan#921 | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | [https://github.com/strongswan/strongswan/commit/3eecd40cec6415fc033f8d9141ab652047e71524] | ||
18 | |||
19 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
20 | --- | ||
21 | .../plugins/openssl/openssl_plugin.c | 27 +++---------------- | ||
22 | 1 file changed, 3 insertions(+), 24 deletions(-) | ||
23 | |||
24 | diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c | ||
25 | index 6b4923649..1491d5cf8 100644 | ||
26 | --- a/src/libstrongswan/plugins/openssl/openssl_plugin.c | ||
27 | +++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c | ||
28 | @@ -16,7 +16,6 @@ | ||
29 | |||
30 | #include <library.h> | ||
31 | #include <utils/debug.h> | ||
32 | -#include <collections/array.h> | ||
33 | #include <threading/thread.h> | ||
34 | #include <threading/mutex.h> | ||
35 | #include <threading/thread_value.h> | ||
36 | @@ -74,13 +73,6 @@ struct private_openssl_plugin_t { | ||
37 | * public functions | ||
38 | */ | ||
39 | openssl_plugin_t public; | ||
40 | - | ||
41 | -#if OPENSSL_VERSION_NUMBER >= 0x30000000L | ||
42 | - /** | ||
43 | - * Loaded providers | ||
44 | - */ | ||
45 | - array_t *providers; | ||
46 | -#endif | ||
47 | }; | ||
48 | |||
49 | /** | ||
50 | @@ -887,15 +879,6 @@ METHOD(plugin_t, get_features, int, | ||
51 | METHOD(plugin_t, destroy, void, | ||
52 | private_openssl_plugin_t *this) | ||
53 | { | ||
54 | -#if OPENSSL_VERSION_NUMBER >= 0x30000000L | ||
55 | - OSSL_PROVIDER *provider; | ||
56 | - while (array_remove(this->providers, ARRAY_TAIL, &provider)) | ||
57 | - { | ||
58 | - OSSL_PROVIDER_unload(provider); | ||
59 | - } | ||
60 | - array_destroy(this->providers); | ||
61 | -#endif /* OPENSSL_VERSION_NUMBER */ | ||
62 | - | ||
63 | /* OpenSSL 1.1.0 cleans up itself at exit and while OPENSSL_cleanup() exists we | ||
64 | * can't call it as we couldn't re-initialize the library (as required by the | ||
65 | * unit tests and the Android app) */ | ||
66 | @@ -1009,20 +992,16 @@ plugin_t *openssl_plugin_create() | ||
67 | DBG1(DBG_LIB, "unable to load OpenSSL FIPS provider"); | ||
68 | return NULL; | ||
69 | } | ||
70 | - array_insert_create(&this->providers, ARRAY_TAIL, fips); | ||
71 | /* explicitly load the base provider containing encoding functions */ | ||
72 | - array_insert_create(&this->providers, ARRAY_TAIL, | ||
73 | - OSSL_PROVIDER_load(NULL, "base")); | ||
74 | + OSSL_PROVIDER_load(NULL, "base"); | ||
75 | } | ||
76 | else if (lib->settings->get_bool(lib->settings, "%s.plugins.openssl.load_legacy", | ||
77 | TRUE, lib->ns)) | ||
78 | { | ||
79 | /* load the legacy provider for algorithms like MD4, DES, BF etc. */ | ||
80 | - array_insert_create(&this->providers, ARRAY_TAIL, | ||
81 | - OSSL_PROVIDER_load(NULL, "legacy")); | ||
82 | + OSSL_PROVIDER_load(NULL, "legacy"); | ||
83 | /* explicitly load the default provider, as mentioned by crypto(7) */ | ||
84 | - array_insert_create(&this->providers, ARRAY_TAIL, | ||
85 | - OSSL_PROVIDER_load(NULL, "default")); | ||
86 | + OSSL_PROVIDER_load(NULL, "default"); | ||
87 | } | ||
88 | ossl_provider_names_t data = {}; | ||
89 | OSSL_PROVIDER_do_all(NULL, concat_ossl_providers, &data); | ||
90 | -- | ||
91 | 2.25.1 | ||
92 | |||
diff --git a/meta-networking/recipes-support/strongswan/files/fix-funtion-parameter.patch b/meta-networking/recipes-support/strongswan/files/fix-funtion-parameter.patch deleted file mode 100644 index 5945507bf..000000000 --- a/meta-networking/recipes-support/strongswan/files/fix-funtion-parameter.patch +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | From 9f97479373f3fceedc471074b81486d77a49618d Mon Sep 17 00:00:00 2001 | ||
2 | From: "Roy.Li" <rongqing.li@windriver.com> | ||
3 | Date: Tue, 4 Mar 2014 14:38:42 +0800 | ||
4 | Subject: [PATCH] fix the function parameter | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Original openssl_diffie_hellman_create has three parameters, but | ||
9 | it is reassigned a function pointer which has one parameter, and | ||
10 | is called with one parameter, which will lead to segment fault | ||
11 | on PPC, Now we simply correct the number of parameters. | ||
12 | |||
13 | #0 0x484d4aa0 in __GI_raise (sig=6) | ||
14 | at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 | ||
15 | #1 0x484d9930 in __GI_abort () at abort.c:91 | ||
16 | #2 0x10002064 in segv_handler (signal=11) at charon.c:224 | ||
17 | #3 <signal handler called> | ||
18 | #4 0x48d89630 in openssl_diffie_hellman_create (group=MODP_1024_BIT, g=..., | ||
19 | p=<error reading variable: Cannot access memory at address 0x0>) | ||
20 | at openssl_diffie_hellman.c:143 | ||
21 | #5 0x482c54f8 in create_dh (this=0x11ac6e68, group=MODP_1024_BIT) | ||
22 | at crypto/crypto_factory.c:358 | ||
23 | #6 0x48375884 in create_dh (this=<optimized out>, group=<optimized out>) | ||
24 | at sa/keymat.c:132 | ||
25 | #7 0x483843b8 in process_payloads (this=0x51400a78, message=<optimized | ||
26 | out>) | ||
27 | at sa/tasks/ike_init.c:200 | ||
28 | #8 0x483844d0 in process_r (this=0x51400a78, message=0x51500778) | ||
29 | at sa/tasks/ike_init.c:319 | ||
30 | #9 0x48374c9c in process_request (message=0x51500778, this=0x51400d20) | ||
31 | at sa/task_manager.c:870 | ||
32 | #10 process_message (this=0x51400d20, msg=0x51500778) at | ||
33 | sa/task_manager.c:925 | ||
34 | #11 0x4836c378 in process_message (this=0x514005f0, message=0x51500778) | ||
35 | at sa/ike_sa.c:1317 | ||
36 | #12 0x48362270 in execute (this=0x515008d0) | ||
37 | at processing/jobs/process_message_job.c:74 | ||
38 | |||
39 | Signed-off-by: Roy.Li <rongqing.li@windriver.com> | ||
40 | |||
41 | --- | ||
42 | src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c | 8 +++++++- | ||
43 | src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h | 4 +++- | ||
44 | src/libstrongswan/plugins/openssl/openssl_plugin.c | 1 + | ||
45 | 3 files changed, 11 insertions(+), 2 deletions(-) | ||
46 | |||
47 | diff --git a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c | ||
48 | index 8e9c118..a73b038 100644 | ||
49 | --- a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c | ||
50 | +++ b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c | ||
51 | @@ -192,7 +192,7 @@ METHOD(diffie_hellman_t, destroy, void, | ||
52 | /* | ||
53 | * Described in header. | ||
54 | */ | ||
55 | -openssl_diffie_hellman_t *openssl_diffie_hellman_create( | ||
56 | +openssl_diffie_hellman_t *openssl_diffie_hellman_create_custom( | ||
57 | diffie_hellman_group_t group, ...) | ||
58 | { | ||
59 | private_openssl_diffie_hellman_t *this; | ||
60 | @@ -255,5 +255,11 @@ openssl_diffie_hellman_t *openssl_diffie_hellman_create( | ||
61 | DBG2(DBG_LIB, "size of DH secret exponent: %d bits", BN_num_bits(privkey)); | ||
62 | return &this->public; | ||
63 | } | ||
64 | +openssl_diffie_hellman_t *openssl_diffie_hellman_create( diffie_hellman_group_t group) | ||
65 | +{ | ||
66 | + chunk_t g; | ||
67 | + chunk_t p; | ||
68 | + openssl_diffie_hellman_create_custom(group, g, p); | ||
69 | +} | ||
70 | |||
71 | #endif /* OPENSSL_NO_DH */ | ||
72 | diff --git a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h | ||
73 | index 5de5520..22586e0 100644 | ||
74 | --- a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h | ||
75 | +++ b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h | ||
76 | @@ -43,8 +43,10 @@ struct openssl_diffie_hellman_t { | ||
77 | * @param ... expects generator and prime as chunk_t if MODP_CUSTOM | ||
78 | * @return openssl_diffie_hellman_t object, NULL if not supported | ||
79 | */ | ||
80 | -openssl_diffie_hellman_t *openssl_diffie_hellman_create( | ||
81 | +openssl_diffie_hellman_t *openssl_diffie_hellman_create_custom( | ||
82 | diffie_hellman_group_t group, ...); | ||
83 | +openssl_diffie_hellman_t *openssl_diffie_hellman_create( | ||
84 | + diffie_hellman_group_t group); | ||
85 | |||
86 | #endif /** OPENSSL_DIFFIE_HELLMAN_H_ @}*/ | ||
87 | |||
88 | diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c | ||
89 | index 8b0a7c5..114d575 100644 | ||
90 | --- a/src/libstrongswan/plugins/openssl/openssl_plugin.c | ||
91 | +++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c | ||
92 | @@ -609,6 +609,7 @@ METHOD(plugin_t, get_features, int, | ||
93 | PLUGIN_PROVIDE(DH, MODP_1024_BIT), | ||
94 | PLUGIN_PROVIDE(DH, MODP_1024_160), | ||
95 | PLUGIN_PROVIDE(DH, MODP_768_BIT), | ||
96 | + PLUGIN_REGISTER(DH, openssl_diffie_hellman_create_custom), | ||
97 | PLUGIN_PROVIDE(DH, MODP_CUSTOM), | ||
98 | #endif | ||
99 | #ifndef OPENSSL_NO_RSA | ||
diff --git a/meta-networking/recipes-support/strongswan/strongswan_5.9.4.bb b/meta-networking/recipes-support/strongswan/strongswan_5.9.5.bb index babfe17d2..cfb7b41fa 100644 --- a/meta-networking/recipes-support/strongswan/strongswan_5.9.4.bb +++ b/meta-networking/recipes-support/strongswan/strongswan_5.9.5.bb | |||
@@ -9,11 +9,10 @@ DEPENDS = "flex-native flex bison-native" | |||
9 | DEPENDS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'tpm2', ' tpm2-tss', '', d)}" | 9 | DEPENDS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'tpm2', ' tpm2-tss', '', d)}" |
10 | 10 | ||
11 | SRC_URI = "http://download.strongswan.org/strongswan-${PV}.tar.bz2 \ | 11 | SRC_URI = "http://download.strongswan.org/strongswan-${PV}.tar.bz2 \ |
12 | file://fix-funtion-parameter.patch \ | 12 | file://0001-openssl-Don-t-unload-providers.patch \ |
13 | file://0001-memory.h-Include-stdint.h-for-uintptr_t.patch \ | ||
14 | " | 13 | " |
15 | 14 | ||
16 | SRC_URI[sha256sum] = "45fdf1a4c2af086d8ff5b76fd7b21d3b6f0890f365f83bf4c9a75dda26887518" | 15 | SRC_URI[sha256sum] = "983e4ef4a4c6c9d69f5fe6707c7fe0b2b9a9291943bbf4e008faab6bf91c0bdd" |
17 | 16 | ||
18 | UPSTREAM_CHECK_REGEX = "strongswan-(?P<pver>\d+(\.\d+)+)\.tar" | 17 | UPSTREAM_CHECK_REGEX = "strongswan-(?P<pver>\d+(\.\d+)+)\.tar" |
19 | 18 | ||