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