tls_hkdf_label_t client_label,
tls_hkdf_label_t server_label)
{
- tls_aead_t *aead_c = this->aead_out, *aead_s = this->aead_in;
+ tls_aead_t *aead_c, *aead_s;
+ suite_algs_t *algs;
+ algs = find_suite(this->suite);
+ destroy_aeads(this);
+ if (!create_aead(this, algs))
+ {
+ return FALSE;
+ }
+ aead_c = this->aead_out;
+ aead_s = this->aead_in;
if (this->tls->is_server(this->tls))
{
aead_c = this->aead_in;
METHOD(tls_crypto_t, update_app_keys, bool,
private_tls_crypto_t *this, bool inbound)
{
+ suite_algs_t *algs;
tls_hkdf_label_t label = TLS_HKDF_UPD_C_TRAFFIC;
+ algs = find_suite(this->suite);
+ destroy_aeads(this);
+ if (!create_aead(this, algs))
+ {
+ return FALSE;
+ }
if (this->tls->is_server(this->tls) != inbound)
{
label = TLS_HKDF_UPD_S_TRAFFIC;
if (inbound)
{
this->protection->set_cipher(this->protection, TRUE, this->aead_in);
+ this->aead_in = NULL;
}
else
{
this->protection->set_cipher(this->protection, FALSE, this->aead_out);
+ this->aead_out = NULL;
}
}
}
{
if (inbound)
{
+ DESTROY_IF(this->aead_in);
this->aead_in = aead;
this->seq_in = 0;
}
else
{
+ DESTROY_IF(this->aead_out);
this->aead_out = aead;
this->seq_out = 0;
}
METHOD(tls_protection_t, destroy, void,
private_tls_protection_t *this)
{
+ DESTROY_IF(this->aead_in);
+ DESTROY_IF(this->aead_out);
free(this);
}