aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/transforms
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2005-12-07 07:27:28 +0000
committerMartin Willi <martin@strongswan.org>2005-12-07 07:27:28 +0000
commit79b8aa19851524b98d046f74a7338fea7f0aba69 (patch)
tree645ccad9e386ec1d21871ea6c16ca3a4077ef883 /Source/charon/transforms
parentdab28cedbd5f9e3e920d8aa60b2a455f812d205c (diff)
downloadstrongswan-79b8aa19851524b98d046f74a7338fea7f0aba69.tar.bz2
strongswan-79b8aa19851524b98d046f74a7338fea7f0aba69.tar.xz
- fixed gmp initialization bugs
- fixed spi check bug in ike_sa_init_requested
Diffstat (limited to 'Source/charon/transforms')
-rw-r--r--Source/charon/transforms/diffie_hellman.c4
-rw-r--r--Source/charon/transforms/rsa/rsa_private_key.c9
-rw-r--r--Source/charon/transforms/rsa/rsa_public_key.c3
3 files changed, 15 insertions, 1 deletions
diff --git a/Source/charon/transforms/diffie_hellman.c b/Source/charon/transforms/diffie_hellman.c
index e45b0b368..27aa80cc0 100644
--- a/Source/charon/transforms/diffie_hellman.c
+++ b/Source/charon/transforms/diffie_hellman.c
@@ -538,11 +538,11 @@ static void destroy(private_diffie_hellman_t *this)
mpz_clear(this->modulus);
mpz_clear(this->my_prime);
mpz_clear(this->my_public_value);
+ mpz_clear(this->other_public_value);
if (this->shared_secret_is_computed)
{
/* other public value gets initialized together with shared secret */
- mpz_clear(this->other_public_value);
mpz_clear(this->shared_secret);
}
allocator_free(this);
@@ -569,6 +569,8 @@ diffie_hellman_t *diffie_hellman_create(diffie_hellman_group_t dh_group_number)
/* private variables */
this->dh_group_number = dh_group_number;
+ mpz_init(this->modulus);
+ mpz_init(this->other_public_value);
/* set this->modulus */
if (this->set_modulus(this) != SUCCESS)
diff --git a/Source/charon/transforms/rsa/rsa_private_key.c b/Source/charon/transforms/rsa/rsa_private_key.c
index 60673d746..c5614324b 100644
--- a/Source/charon/transforms/rsa/rsa_private_key.c
+++ b/Source/charon/transforms/rsa/rsa_private_key.c
@@ -279,6 +279,15 @@ static status_t set_key(private_rsa_private_key_t *this, chunk_t key)
exp2.ptr = key.ptr + this->k * 6;
coeff.ptr = key.ptr + this->k * 7;
+ mpz_init(this->n);
+ mpz_init(this->e);
+ mpz_init(this->p);
+ mpz_init(this->q);
+ mpz_init(this->d);
+ mpz_init(this->exp1);
+ mpz_init(this->exp2);
+ mpz_init(this->coeff);
+
mpz_import(this->n, this->k, 1, 1, 1, 0, n.ptr);
mpz_import(this->e, this->k, 1, 1, 1, 0, e.ptr);
mpz_import(this->p, this->k, 1, 1, 1, 0, p.ptr);
diff --git a/Source/charon/transforms/rsa/rsa_public_key.c b/Source/charon/transforms/rsa/rsa_public_key.c
index 9547b23d6..6271e4a05 100644
--- a/Source/charon/transforms/rsa/rsa_public_key.c
+++ b/Source/charon/transforms/rsa/rsa_public_key.c
@@ -285,6 +285,9 @@ static status_t set_key(private_rsa_public_key_t *this, chunk_t key)
e.len = n.len;
e.ptr = key.ptr + n.len;
+ mpz_init(this->n);
+ mpz_init(this->e);
+
mpz_import(this->n, n.len, 1, 1, 1, 0, n.ptr);
mpz_import(this->e, n.len, 1, 1, 1, 0, e.ptr);