aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-04-09 14:59:04 +0200
committerMartin Willi <martin@revosec.ch>2015-04-15 14:38:41 +0200
commit1a522d327ed1931f384f790a2e3ceb1dc5fadb9d (patch)
tree0f89725163e6f4660aa6ddec283576ce907960ee /src/libstrongswan/plugins
parentb8f576a803bee0effb4e3cd07da460053e40a805 (diff)
downloadstrongswan-1a522d327ed1931f384f790a2e3ceb1dc5fadb9d.tar.bz2
strongswan-1a522d327ed1931f384f790a2e3ceb1dc5fadb9d.tar.xz
gmp: Support setting Diffie-Hellman private values
Diffstat (limited to 'src/libstrongswan/plugins')
-rw-r--r--src/libstrongswan/plugins/gmp/gmp_diffie_hellman.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/gmp/gmp_diffie_hellman.c b/src/libstrongswan/plugins/gmp/gmp_diffie_hellman.c
index 4fcb168fa..b7ee94ee0 100644
--- a/src/libstrongswan/plugins/gmp/gmp_diffie_hellman.c
+++ b/src/libstrongswan/plugins/gmp/gmp_diffie_hellman.c
@@ -162,6 +162,15 @@ METHOD(diffie_hellman_t, get_my_public_value, bool,
return TRUE;
}
+METHOD(diffie_hellman_t, set_private_value, bool,
+ private_gmp_diffie_hellman_t *this, chunk_t value)
+{
+ mpz_import(this->xa, value.len, 1, 1, 1, 0, value.ptr);
+ mpz_powm(this->ya, this->g, this->xa, this->p);
+ this->computed = FALSE;
+ return TRUE;
+}
+
METHOD(diffie_hellman_t, get_shared_secret, bool,
private_gmp_diffie_hellman_t *this, chunk_t *secret)
{
@@ -212,6 +221,7 @@ static gmp_diffie_hellman_t *create_generic(diffie_hellman_group_t group,
.get_shared_secret = _get_shared_secret,
.set_other_public_value = _set_other_public_value,
.get_my_public_value = _get_my_public_value,
+ .set_private_value = _set_private_value,
.get_dh_group = _get_dh_group,
.destroy = _destroy,
},