|
@@ -403,9 +403,7 @@ encode_enc_key(const hs_desc_intro_point_t *ip)
|
|
|
tor_assert(ip);
|
|
|
|
|
|
/* Base64 encode the encryption key for the "enc-key" field. */
|
|
|
- if (curve25519_public_to_base64(key_b64, &ip->enc_key) < 0) {
|
|
|
- goto done;
|
|
|
- }
|
|
|
+ curve25519_public_to_base64(key_b64, &ip->enc_key);
|
|
|
if (tor_cert_encode_ed22519(ip->enc_key_cert, &encoded_cert) < 0) {
|
|
|
goto done;
|
|
|
}
|
|
@@ -421,7 +419,7 @@ encode_enc_key(const hs_desc_intro_point_t *ip)
|
|
|
}
|
|
|
|
|
|
/* Encode an introduction point onion key. Return a newly allocated string
|
|
|
- * with it. On failure, return NULL. */
|
|
|
+ * with it. Can not fail. */
|
|
|
static char *
|
|
|
encode_onion_key(const hs_desc_intro_point_t *ip)
|
|
|
{
|
|
@@ -431,12 +429,9 @@ encode_onion_key(const hs_desc_intro_point_t *ip)
|
|
|
tor_assert(ip);
|
|
|
|
|
|
/* Base64 encode the encryption key for the "onion-key" field. */
|
|
|
- if (curve25519_public_to_base64(key_b64, &ip->onion_key) < 0) {
|
|
|
- goto done;
|
|
|
- }
|
|
|
+ curve25519_public_to_base64(key_b64, &ip->onion_key);
|
|
|
tor_asprintf(&encoded, "%s ntor %s", str_ip_onion_key, key_b64);
|
|
|
|
|
|
- done:
|
|
|
return encoded;
|
|
|
}
|
|
|
|
|
@@ -797,8 +792,8 @@ get_inner_encrypted_layer_plaintext(const hs_descriptor_t *desc)
|
|
|
/* Create the middle layer of the descriptor, which includes the client auth
|
|
|
* data and the encrypted inner layer (provided as a base64 string at
|
|
|
* <b>layer2_b64_ciphertext</b>). Return a newly-allocated string with the
|
|
|
- * layer plaintext, or NULL if an error occurred. It's the responsibility of
|
|
|
- * the caller to free the returned string. */
|
|
|
+ * layer plaintext. It's the responsibility of the caller to free the returned
|
|
|
+ * string. Can not fail. */
|
|
|
static char *
|
|
|
get_outer_encrypted_layer_plaintext(const hs_descriptor_t *desc,
|
|
|
const char *layer2_b64_ciphertext)
|
|
@@ -817,10 +812,7 @@ get_outer_encrypted_layer_plaintext(const hs_descriptor_t *desc,
|
|
|
tor_assert(!tor_mem_is_zero((char *) ephemeral_pubkey->public_key,
|
|
|
CURVE25519_PUBKEY_LEN));
|
|
|
|
|
|
- if (curve25519_public_to_base64(ephemeral_key_base64,
|
|
|
- ephemeral_pubkey) < 0) {
|
|
|
- goto done;
|
|
|
- }
|
|
|
+ curve25519_public_to_base64(ephemeral_key_base64, ephemeral_pubkey);
|
|
|
smartlist_add_asprintf(lines, "%s %s\n",
|
|
|
str_desc_auth_key, ephemeral_key_base64);
|
|
|
|
|
@@ -845,7 +837,6 @@ get_outer_encrypted_layer_plaintext(const hs_descriptor_t *desc,
|
|
|
|
|
|
layer1_str = smartlist_join_strings(lines, "", 0, NULL);
|
|
|
|
|
|
- done:
|
|
|
/* We need to memwipe all lines because it contains the ephemeral key */
|
|
|
SMARTLIST_FOREACH(lines, char *, a, memwipe(a, 0, strlen(a)));
|
|
|
SMARTLIST_FOREACH(lines, char *, a, tor_free(a));
|