Check rng return value when generating TLS session identifiers
This commit is contained in:
@@ -313,11 +313,11 @@ static status_t process_client_hello(private_tls_server_t *this,
|
|||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
rng = lib->crypto->create_rng(lib->crypto, RNG_STRONG);
|
rng = lib->crypto->create_rng(lib->crypto, RNG_STRONG);
|
||||||
if (rng)
|
if (!rng || !rng->allocate_bytes(rng, SESSION_ID_SIZE, &this->session))
|
||||||
{
|
{
|
||||||
rng->allocate_bytes(rng, SESSION_ID_SIZE, &this->session);
|
DBG1(DBG_TLS, "generating TLS session identifier failed, skipped");
|
||||||
rng->destroy(rng);
|
|
||||||
}
|
}
|
||||||
|
DESTROY_IF(rng);
|
||||||
DBG1(DBG_TLS, "negotiated %N using suite %N",
|
DBG1(DBG_TLS, "negotiated %N using suite %N",
|
||||||
tls_version_names, this->tls->get_version(this->tls),
|
tls_version_names, this->tls->get_version(this->tls),
|
||||||
tls_cipher_suite_names, this->suite);
|
tls_cipher_suite_names, this->suite);
|
||||||
|
|||||||
Reference in New Issue
Block a user