aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/tests/utils
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2016-05-13 12:16:45 +0200
committerTobias Brunner <tobias@strongswan.org>2016-06-17 18:48:02 +0200
commit7e5424868de9e73d0cf20c2973cbc983f6427542 (patch)
tree1fdc6bc6157f6f0e7adf0447937db08d91d2a269 /src/libcharon/tests/utils
parent1f73a74be0c2398b6261710b0ca25494352f2a25 (diff)
downloadstrongswan-7e5424868de9e73d0cf20c2973cbc983f6427542.tar.bz2
strongswan-7e5424868de9e73d0cf20c2973cbc983f6427542.tar.xz
unit-tests: Register mock DH implementation as static plugin feature
Diffstat (limited to 'src/libcharon/tests/utils')
-rw-r--r--src/libcharon/tests/utils/exchange_test_helper.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcharon/tests/utils/exchange_test_helper.c b/src/libcharon/tests/utils/exchange_test_helper.c
index 17553bc81..47da9e49a 100644
--- a/src/libcharon/tests/utils/exchange_test_helper.c
+++ b/src/libcharon/tests/utils/exchange_test_helper.c
@@ -15,6 +15,7 @@
#include "exchange_test_helper.h"
#include "mock_ipsec.h"
+#include "mock_dh.h"
#include <credentials/sets/mem_cred.h>
@@ -201,6 +202,13 @@ static void initialize_logging()
void exchange_test_helper_init(char *plugins)
{
private_exchange_test_helper_t *this;
+ plugin_feature_t features[] = {
+ PLUGIN_REGISTER(DH, mock_dh_create),
+ /* we only need to support a limited number of DH groups */
+ PLUGIN_PROVIDE(DH, MODP_2048_BIT),
+ PLUGIN_PROVIDE(DH, MODP_3072_BIT),
+ PLUGIN_PROVIDE(DH, ECP_256_BIT),
+ };
INIT(this,
.public = {
@@ -217,10 +225,13 @@ void exchange_test_helper_init(char *plugins)
);
initialize_logging();
+ lib->plugins->add_static_features(lib->plugins, "exchange-test-helper",
+ features, countof(features), TRUE, NULL, NULL);
/* the libcharon unit tests only load the libstrongswan plugins, unless
* TESTS_PLUGINS is defined */
charon->initialize(charon, plugins);
lib->plugins->status(lib->plugins, LEVEL_CTRL);
+
/* the original sender is not initialized because there is no socket */
charon->sender = (sender_t*)this->public.sender;
/* and there is no kernel plugin loaded