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 #4 0x48d89630 in openssl_diffie_hellman_create (group=MODP_1024_BIT, g=..., p=) 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=, group=) at sa/keymat.c:132 #7 0x483843b8 in process_payloads (this=0x51400a78, message=) 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 --- 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