diff options
author | Tobias Brunner <tobias@strongswan.org> | 2011-11-02 17:00:27 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2011-11-02 20:27:54 +0100 |
commit | 43cd036a771c5a3ca120dd15e553c06ce8321e04 (patch) | |
tree | ced4315f17647ac7ed2ba001ba51c8583a9bcfb3 | |
parent | 50ad6eacb6b045547d4519a541df416810a9d46a (diff) | |
download | strongswan-43cd036a771c5a3ca120dd15e553c06ce8321e04.tar.bz2 strongswan-43cd036a771c5a3ca120dd15e553c06ce8321e04.tar.xz |
pkcs11: Invalid free fixed in DH/ECDH implementation.
-rw-r--r-- | src/libstrongswan/plugins/pkcs11/pkcs11_dh.c | 5 |
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; } |