mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Reduce log level for someone else sending us weak DH keys.
See task 1114. The most plausible explanation for someone sending us weak DH keys is that they experiment with their Tor code or implement a new Tor client. Usually, we don't care about such events, especially not on warn level. If we really care about someone not following the Tor protocol, we can set ProtocolWarnings to 1.
This commit is contained in:
+6
-4
@@ -253,8 +253,9 @@ onion_skin_server_handshake(const char *onion_skin, /*ONIONSKIN_CHALLENGE_LEN*/
|
||||
|
||||
key_material_len = DIGEST_LEN+key_out_len;
|
||||
key_material = tor_malloc(key_material_len);
|
||||
len = crypto_dh_compute_secret(dh, challenge, DH_KEY_LEN,
|
||||
key_material, key_material_len);
|
||||
len = crypto_dh_compute_secret(LOG_PROTOCOL_WARN, dh, challenge,
|
||||
DH_KEY_LEN, key_material,
|
||||
key_material_len);
|
||||
if (len < 0) {
|
||||
log_info(LD_GENERAL, "crypto_dh_compute_secret failed.");
|
||||
goto err;
|
||||
@@ -304,8 +305,9 @@ onion_skin_client_handshake(crypto_dh_env_t *handshake_state,
|
||||
|
||||
key_material_len = DIGEST_LEN + key_out_len;
|
||||
key_material = tor_malloc(key_material_len);
|
||||
len = crypto_dh_compute_secret(handshake_state, handshake_reply, DH_KEY_LEN,
|
||||
key_material, key_material_len);
|
||||
len = crypto_dh_compute_secret(LOG_PROTOCOL_WARN, handshake_state,
|
||||
handshake_reply, DH_KEY_LEN, key_material,
|
||||
key_material_len);
|
||||
if (len < 0)
|
||||
goto err;
|
||||
|
||||
|
||||
+3
-2
@@ -621,8 +621,9 @@ rend_client_receive_rendezvous(origin_circuit_t *circ, const char *request,
|
||||
tor_assert(circ->build_state->pending_final_cpath);
|
||||
hop = circ->build_state->pending_final_cpath;
|
||||
tor_assert(hop->dh_handshake_state);
|
||||
if (crypto_dh_compute_secret(hop->dh_handshake_state, request, DH_KEY_LEN,
|
||||
keys, DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) {
|
||||
if (crypto_dh_compute_secret(LOG_PROTOCOL_WARN, hop->dh_handshake_state,
|
||||
request, DH_KEY_LEN, keys,
|
||||
DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) {
|
||||
log_warn(LD_GENERAL, "Couldn't complete DH handshake.");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1090,8 @@ rend_service_introduce(origin_circuit_t *circuit, const char *request,
|
||||
reason = END_CIRC_REASON_INTERNAL;
|
||||
goto err;
|
||||
}
|
||||
if (crypto_dh_compute_secret(dh, ptr+REND_COOKIE_LEN, DH_KEY_LEN, keys,
|
||||
if (crypto_dh_compute_secret(LOG_PROTOCOL_WARN, dh, ptr+REND_COOKIE_LEN,
|
||||
DH_KEY_LEN, keys,
|
||||
DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) {
|
||||
log_warn(LD_BUG, "Internal error: couldn't complete DH handshake");
|
||||
reason = END_CIRC_REASON_INTERNAL;
|
||||
|
||||
Reference in New Issue
Block a user