Add a return value to tls_prf_t.set_key()

This commit is contained in:
Martin Willi
2012-07-16 14:53:33 +02:00
parent 97b30b93b0
commit e7d98b8c99
3 changed files with 13 additions and 9 deletions
+7 -6
View File
@@ -1483,13 +1483,14 @@ static bool derive_master(private_tls_crypto_t *this, chunk_t premaster,
/* derive master secret */
seed = chunk_cata("cc", client_random, server_random);
this->prf->set_key(this->prf, premaster);
if (!this->prf->get_bytes(this->prf, "master secret", seed,
sizeof(master), master))
if (!this->prf->set_key(this->prf, premaster) ||
!this->prf->get_bytes(this->prf, "master secret", seed,
sizeof(master), master) ||
!this->prf->set_key(this->prf, chunk_from_thing(master)))
{
return FALSE;
}
this->prf->set_key(this->prf, chunk_from_thing(master));
if (this->cache && session.len)
{
@@ -1624,8 +1625,8 @@ METHOD(tls_crypto_t, resume_session, tls_cipher_suite_t,
this->suite = select_cipher_suite(this, &this->suite, 1, KEY_ANY);
if (this->suite)
{
this->prf->set_key(this->prf, master);
if (!expand_keys(this, client_random, server_random))
if (!this->prf->set_key(this->prf, master) ||
!expand_keys(this, client_random, server_random))
{
this->suite = 0;
}