mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
cleanups on r12579
svn:r12580
This commit is contained in:
parent
466abecef4
commit
7f12ebc3fa
@ -486,6 +486,7 @@ crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest,
|
|||||||
*/
|
*/
|
||||||
if (!PEM_write_bio_RSAPublicKey(b, env->key)) {
|
if (!PEM_write_bio_RSAPublicKey(b, env->key)) {
|
||||||
crypto_log_errors(LOG_WARN, "writing public key to string");
|
crypto_log_errors(LOG_WARN, "writing public key to string");
|
||||||
|
/* XXX020 leaks b? maybe "BIO_free(b);" would be smart here. -RD */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ rend_encode_v2_intro_points(char **ipos_base64,
|
|||||||
size_t onion_key_len;
|
size_t onion_key_len;
|
||||||
crypto_pk_env_t *intro_key;
|
crypto_pk_env_t *intro_key;
|
||||||
char *service_key = NULL;
|
char *service_key = NULL;
|
||||||
char *addr = NULL;
|
char *address = NULL;
|
||||||
size_t service_key_len;
|
size_t service_key_len;
|
||||||
int res;
|
int res;
|
||||||
char hex_digest[HEX_DIGEST_LEN+2]; /* includes $ and NUL. */
|
char hex_digest[HEX_DIGEST_LEN+2]; /* includes $ and NUL. */
|
||||||
@ -217,7 +217,6 @@ rend_encode_v2_intro_points(char **ipos_base64,
|
|||||||
if (crypto_pk_write_public_key_to_string(info->onion_key, &onion_key,
|
if (crypto_pk_write_public_key_to_string(info->onion_key, &onion_key,
|
||||||
&onion_key_len) < 0) {
|
&onion_key_len) < 0) {
|
||||||
log_warn(LD_REND, "Could not write onion key.");
|
log_warn(LD_REND, "Could not write onion key.");
|
||||||
tor_free(onion_key);
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Encode intro key. */
|
/* Encode intro key. */
|
||||||
@ -230,12 +229,11 @@ rend_encode_v2_intro_points(char **ipos_base64,
|
|||||||
crypto_pk_write_public_key_to_string(intro_key, &service_key,
|
crypto_pk_write_public_key_to_string(intro_key, &service_key,
|
||||||
&service_key_len) < 0) {
|
&service_key_len) < 0) {
|
||||||
log_warn(LD_REND, "Could not write intro key.");
|
log_warn(LD_REND, "Could not write intro key.");
|
||||||
tor_free(service_key);
|
|
||||||
tor_free(onion_key);
|
tor_free(onion_key);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Assemble everything for this introduction point. */
|
/* Assemble everything for this introduction point. */
|
||||||
addr = tor_dup_addr(info->addr);
|
address = tor_dup_addr(info->addr);
|
||||||
res = tor_snprintf(unenc + unenc_written, unenc_len - unenc_written,
|
res = tor_snprintf(unenc + unenc_written, unenc_len - unenc_written,
|
||||||
"introduction-point %s\n"
|
"introduction-point %s\n"
|
||||||
"ip-address %s\n"
|
"ip-address %s\n"
|
||||||
@ -243,11 +241,11 @@ rend_encode_v2_intro_points(char **ipos_base64,
|
|||||||
"onion-key\n%s"
|
"onion-key\n%s"
|
||||||
"service-key\n%s",
|
"service-key\n%s",
|
||||||
id_base32,
|
id_base32,
|
||||||
addr,
|
address,
|
||||||
info->port,
|
info->port,
|
||||||
onion_key,
|
onion_key,
|
||||||
service_key);
|
service_key);
|
||||||
tor_free(addr);
|
tor_free(address);
|
||||||
tor_free(onion_key);
|
tor_free(onion_key);
|
||||||
tor_free(service_key);
|
tor_free(service_key);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
@ -357,7 +355,6 @@ rend_encode_v2_descriptors(smartlist_t *desc_strs_out,
|
|||||||
if (desc->n_intro_points > 0 &&
|
if (desc->n_intro_points > 0 &&
|
||||||
rend_encode_v2_intro_points(&ipos_base64, desc, descriptor_cookie) < 0) {
|
rend_encode_v2_intro_points(&ipos_base64, desc, descriptor_cookie) < 0) {
|
||||||
log_warn(LD_REND, "Encoding of introduction points did not succeed.");
|
log_warn(LD_REND, "Encoding of introduction points did not succeed.");
|
||||||
tor_free(ipos_base64);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Encode REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS descriptors. */
|
/* Encode REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS descriptors. */
|
||||||
@ -392,7 +389,6 @@ rend_encode_v2_descriptors(smartlist_t *desc_strs_out,
|
|||||||
if (crypto_pk_write_public_key_to_string(desc->pk, &permanent_key,
|
if (crypto_pk_write_public_key_to_string(desc->pk, &permanent_key,
|
||||||
&permanent_key_len) < 0) {
|
&permanent_key_len) < 0) {
|
||||||
log_warn(LD_BUG, "Could not write public key to string.");
|
log_warn(LD_BUG, "Could not write public key to string.");
|
||||||
tor_free(permanent_key);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/* Encode timestamp. */
|
/* Encode timestamp. */
|
||||||
|
Loading…
Reference in New Issue
Block a user