aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-09-03 09:31:51 +0200
committerMartin Willi <martin@revosec.ch>2010-09-03 09:33:15 +0200
commit42b1ac91c4240a481eccaad0d1596432c4f01181 (patch)
treec02372d7937f5f325b89c11d3317696af47165e4 /src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
parent6deeacd965a83e1222b70051280dd247d1bfd170 (diff)
downloadstrongswan-42b1ac91c4240a481eccaad0d1596432c4f01181.tar.bz2
strongswan-42b1ac91c4240a481eccaad0d1596432c4f01181.tar.xz
Added support for MODP_CUSTOM to openssl plugin
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
index 4a00c3163..b27aa3391 100644
--- a/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
+++ b/src/libstrongswan/plugins/openssl/openssl_diffie_hellman.c
@@ -138,7 +138,8 @@ METHOD(diffie_hellman_t, destroy, void,
/*
* Described in header.
*/
-openssl_diffie_hellman_t *openssl_diffie_hellman_create(diffie_hellman_group_t group)
+openssl_diffie_hellman_t *openssl_diffie_hellman_create(
+ diffie_hellman_group_t group, chunk_t g, chunk_t p)
{
private_openssl_diffie_hellman_t *this;
@@ -166,11 +167,19 @@ openssl_diffie_hellman_t *openssl_diffie_hellman_create(diffie_hellman_group_t g
this->pub_key = BN_new();
this->shared_secret = chunk_empty;
- /* find a modulus according to group */
- if (set_modulus(this) != SUCCESS)
+ if (group == MODP_CUSTOM)
{
- destroy(this);
- return NULL;
+ this->dh->p = BN_bin2bn(p.ptr, p.len, NULL);
+ this->dh->g = BN_bin2bn(g.ptr, g.len, NULL);
+ }
+ else
+ {
+ /* find a modulus according to group */
+ if (set_modulus(this) != SUCCESS)
+ {
+ destroy(this);
+ return NULL;
+ }
}
/* generate my public and private values */