aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-11-02 17:00:27 +0100
committerTobias Brunner <tobias@strongswan.org>2011-11-02 20:27:54 +0100
commit43cd036a771c5a3ca120dd15e553c06ce8321e04 (patch)
treeced4315f17647ac7ed2ba001ba51c8583a9bcfb3
parent50ad6eacb6b045547d4519a541df416810a9d46a (diff)
downloadstrongswan-43cd036a771c5a3ca120dd15e553c06ce8321e04.tar.bz2
strongswan-43cd036a771c5a3ca120dd15e553c06ce8321e04.tar.xz
pkcs11: Invalid free fixed in DH/ECDH implementation.
-rw-r--r--src/libstrongswan/plugins/pkcs11/pkcs11_dh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_dh.c b/src/libstrongswan/plugins/pkcs11/pkcs11_dh.c
index f3fc0303d..e48f7dcfe 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_dh.c
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_dh.c
@@ -249,6 +249,7 @@ static bool generate_key_pair_ecp(private_pkcs11_dh_t *this,
CK_ATTRIBUTE pri_attr[] = {
{ CKA_DERIVE, &ck_true, sizeof(ck_true) },
};
+ chunk_t pub_key;
if (!generate_key_pair(this, pub_attr, countof(pub_attr), pri_attr,
countof(pri_attr), CKA_EC_POINT))
{
@@ -260,7 +261,9 @@ static bool generate_key_pair_ecp(private_pkcs11_dh_t *this,
chunk_clear(&this->pub_key);
return FALSE;
}
- this->pub_key = chunk_skip(this->pub_key, 1);
+ pub_key = chunk_clone(chunk_skip(this->pub_key, 1));
+ chunk_clear(&this->pub_key);
+ this->pub_key = pub_key;
return TRUE;
}