diff options
author | Martin Willi <martin@revosec.ch> | 2012-07-06 16:57:17 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-07-16 14:53:38 +0200 |
commit | ce73fc19dbc36d089e595e452356deccd8afcd6f (patch) | |
tree | ba7f244b7e566bd86d3e87e6992d831203322445 /src/libcharon/sa/ikev2/keymat_v2.c | |
parent | 3b96189a2afa4949e1d9cdf7c9fa8244d8d817f0 (diff) | |
download | strongswan-ce73fc19dbc36d089e595e452356deccd8afcd6f.tar.bz2 strongswan-ce73fc19dbc36d089e595e452356deccd8afcd6f.tar.xz |
Add a return value to crypter_t.set_key()
Diffstat (limited to 'src/libcharon/sa/ikev2/keymat_v2.c')
-rw-r--r-- | src/libcharon/sa/ikev2/keymat_v2.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libcharon/sa/ikev2/keymat_v2.c b/src/libcharon/sa/ikev2/keymat_v2.c index f25d0bd0e..91f001bdb 100644 --- a/src/libcharon/sa/ikev2/keymat_v2.c +++ b/src/libcharon/sa/ikev2/keymat_v2.c @@ -225,7 +225,14 @@ static bool derive_ike_traditional(private_keymat_v2_t *this, u_int16_t enc_alg, return FALSE; } DBG4(DBG_IKE, "Sk_ei secret %B", &key); - crypter_i->set_key(crypter_i, key); + if (!crypter_i->set_key(crypter_i, key)) + { + crypter_i->destroy(crypter_i); + crypter_r->destroy(crypter_r); + signer_i->destroy(signer_i); + signer_r->destroy(signer_r); + return FALSE; + } chunk_clear(&key); if (!prf_plus->allocate_bytes(prf_plus, key_size, &key)) @@ -237,7 +244,14 @@ static bool derive_ike_traditional(private_keymat_v2_t *this, u_int16_t enc_alg, return FALSE; } DBG4(DBG_IKE, "Sk_er secret %B", &key); - crypter_r->set_key(crypter_r, key); + if (!crypter_r->set_key(crypter_r, key)) + { + crypter_i->destroy(crypter_i); + crypter_r->destroy(crypter_r); + signer_i->destroy(signer_i); + signer_r->destroy(signer_r); + return FALSE; + } chunk_clear(&key); if (this->initiator) |