mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
Handle failing cases of DH allocation
This commit is contained in:
parent
c939c953ae
commit
76582442a8
@ -808,6 +808,7 @@ tor_tls_context_new(crypto_pk_env_t *identity, unsigned int key_lifetime)
|
|||||||
goto error;
|
goto error;
|
||||||
{
|
{
|
||||||
crypto_dh_env_t *dh = crypto_dh_new(DH_TYPE_TLS);
|
crypto_dh_env_t *dh = crypto_dh_new(DH_TYPE_TLS);
|
||||||
|
tor_assert(dh);
|
||||||
SSL_CTX_set_tmp_dh(result->ctx, _crypto_dh_env_get_dh(dh));
|
SSL_CTX_set_tmp_dh(result->ctx, _crypto_dh_env_get_dh(dh));
|
||||||
crypto_dh_free(dh);
|
crypto_dh_free(dh);
|
||||||
}
|
}
|
||||||
|
@ -259,6 +259,10 @@ onion_skin_server_handshake(const char *onion_skin, /*ONIONSKIN_CHALLENGE_LEN*/
|
|||||||
}
|
}
|
||||||
|
|
||||||
dh = crypto_dh_new(DH_TYPE_CIRCUIT);
|
dh = crypto_dh_new(DH_TYPE_CIRCUIT);
|
||||||
|
if (!dh) {
|
||||||
|
log_warn(LD_BUG, "Couldn't allocate DH key");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
if (crypto_dh_get_public(dh, handshake_reply_out, DH_KEY_LEN)) {
|
if (crypto_dh_get_public(dh, handshake_reply_out, DH_KEY_LEN)) {
|
||||||
log_info(LD_GENERAL, "crypto_dh_get_public failed.");
|
log_info(LD_GENERAL, "crypto_dh_get_public failed.");
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user