blob: da96983e6dcfa0471b74f89e231f6c91a3651862 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001fix the function parameter
2
3Upstream-Status: pending
4
5Original openssl_diffie_hellman_create has three parameters, but
6it is reassigned a function pointer which has one parameter, and
7is called with one parameter, which will lead to segment fault
8on PPC, Now we simply correct the number of parameters.
9
10 #0 0x484d4aa0 in __GI_raise (sig=6)
11 at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
12 #1 0x484d9930 in __GI_abort () at abort.c:91
13 #2 0x10002064 in segv_handler (signal=11) at charon.c:224
14 #3 <signal handler called>
15 #4 0x48d89630 in openssl_diffie_hellman_create (group=MODP_1024_BIT, g=...,
16 p=<error reading variable: Cannot access memory at address 0x0>)
17 at openssl_diffie_hellman.c:143
18 #5 0x482c54f8 in create_dh (this=0x11ac6e68, group=MODP_1024_BIT)
19 at crypto/crypto_factory.c:358
20 #6 0x48375884 in create_dh (this=<optimized out>, group=<optimized out>)
21 at sa/keymat.c:132
22 #7 0x483843b8 in process_payloads (this=0x51400a78, message=<optimized
23 out>)
24 at sa/tasks/ike_init.c:200
25 #8 0x483844d0 in process_r (this=0x51400a78, message=0x51500778)
26 at sa/tasks/ike_init.c:319
27 #9 0x48374c9c in process_request (message=0x51500778, this=0x51400d20)
28 at sa/task_manager.c:870
29 #10 process_message (this=0x51400d20, msg=0x51500778) at
30 sa/task_manager.c:925
31 #11 0x4836c378 in process_message (this=0x514005f0, message=0x51500778)
32 at sa/ike_sa.c:1317
33 #12 0x48362270 in execute (this=0x515008d0)
34 at processing/jobs/process_message_job.c:74
35
36Signed-off-by: Roy.Li <rongqing.li@windriver.com>
37---
38 src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c | 8 +++++++-
39 src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h | 4 +++-
40 src/libstrongswan/plugins/openssl/openssl_plugin.c | 1 +
41 3 files changed, 11 insertions(+), 2 deletions(-)
42
43diff --git a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
44index ff33824..bd21446 100644
45--- a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
46+++ b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
47@@ -142,7 +142,7 @@ METHOD(diffie_hellman_t, destroy, void,
48 /*
49 * Described in header.
50 */
51-openssl_diffie_hellman_t *openssl_diffie_hellman_create(
52+openssl_diffie_hellman_t *openssl_diffie_hellman_create_custom(
53 diffie_hellman_group_t group, chunk_t g, chunk_t p)
54 {
55 private_openssl_diffie_hellman_t *this;
56@@ -197,5 +197,11 @@ openssl_diffie_hellman_t *openssl_diffie_hellman_create(
57
58 return &this->public;
59 }
60+openssl_diffie_hellman_t *openssl_diffie_hellman_create( diffie_hellman_group_t group)
61+{
62+ chunk_t g;
63+ chunk_t p;
64+ openssl_diffie_hellman_create_custom(group, g, p);
65+}
66
67 #endif /* OPENSSL_NO_DH */
68diff --git a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h
69index 53dc59c..eb69eaa 100644
70--- a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h
71+++ b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.h
72@@ -44,8 +44,10 @@ struct openssl_diffie_hellman_t {
73 * @param p custom prime, if MODP_CUSTOM
74 * @return openssl_diffie_hellman_t object, NULL if not supported
75 */
76-openssl_diffie_hellman_t *openssl_diffie_hellman_create(
77+openssl_diffie_hellman_t *openssl_diffie_hellman_create_custom(
78 diffie_hellman_group_t group, chunk_t g, chunk_t p);
79+openssl_diffie_hellman_t *openssl_diffie_hellman_create(
80+ diffie_hellman_group_t group);
81
82 #endif /** OPENSSL_DIFFIE_HELLMAN_H_ @}*/
83
84diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c
85index ff25086..c76873d 100644
86--- a/src/libstrongswan/plugins/openssl/openssl_plugin.c
87+++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c
88@@ -388,6 +388,7 @@ METHOD(plugin_t, get_features, int,
89 PLUGIN_PROVIDE(DH, MODP_1024_BIT),
90 PLUGIN_PROVIDE(DH, MODP_1024_160),
91 PLUGIN_PROVIDE(DH, MODP_768_BIT),
92+ PLUGIN_REGISTER(DH, openssl_diffie_hellman_create_custom),
93 PLUGIN_PROVIDE(DH, MODP_CUSTOM),
94 #endif
95 #ifndef OPENSSL_NO_RSA
96--
971.8.3
98