mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Make n_subcredentials a size_t .
Based on David's review.
This commit is contained in:
parent
ba99287d13
commit
901ed35709
@ -471,7 +471,7 @@ hs_ntor_service_get_introduce1_keys_multi(
|
|||||||
const struct ed25519_public_key_t *intro_auth_pubkey,
|
const struct ed25519_public_key_t *intro_auth_pubkey,
|
||||||
const struct curve25519_keypair_t *intro_enc_keypair,
|
const struct curve25519_keypair_t *intro_enc_keypair,
|
||||||
const struct curve25519_public_key_t *client_ephemeral_enc_pubkey,
|
const struct curve25519_public_key_t *client_ephemeral_enc_pubkey,
|
||||||
int n_subcredentials,
|
size_t n_subcredentials,
|
||||||
const hs_subcredential_t *subcredentials,
|
const hs_subcredential_t *subcredentials,
|
||||||
hs_ntor_intro_cell_keys_t *hs_ntor_intro_cell_keys_out)
|
hs_ntor_intro_cell_keys_t *hs_ntor_intro_cell_keys_out)
|
||||||
{
|
{
|
||||||
@ -499,7 +499,7 @@ hs_ntor_service_get_introduce1_keys_multi(
|
|||||||
secret_input);
|
secret_input);
|
||||||
bad |= safe_mem_is_zero(secret_input, CURVE25519_OUTPUT_LEN);
|
bad |= safe_mem_is_zero(secret_input, CURVE25519_OUTPUT_LEN);
|
||||||
|
|
||||||
for (int i = 0; i < n_subcredentials; ++i) {
|
for (unsigned i = 0; i < n_subcredentials; ++i) {
|
||||||
/* Get ENC_KEY and MAC_KEY! */
|
/* Get ENC_KEY and MAC_KEY! */
|
||||||
get_introduce1_key_material(secret_input, &subcredentials[i],
|
get_introduce1_key_material(secret_input, &subcredentials[i],
|
||||||
&hs_ntor_intro_cell_keys_out[i]);
|
&hs_ntor_intro_cell_keys_out[i]);
|
||||||
|
@ -62,7 +62,7 @@ int hs_ntor_service_get_introduce1_keys_multi(
|
|||||||
const struct ed25519_public_key_t *intro_auth_pubkey,
|
const struct ed25519_public_key_t *intro_auth_pubkey,
|
||||||
const struct curve25519_keypair_t *intro_enc_keypair,
|
const struct curve25519_keypair_t *intro_enc_keypair,
|
||||||
const struct curve25519_public_key_t *client_ephemeral_enc_pubkey,
|
const struct curve25519_public_key_t *client_ephemeral_enc_pubkey,
|
||||||
int n_subcredentials,
|
size_t n_subcredentials,
|
||||||
const hs_subcredential_t *subcredentials,
|
const hs_subcredential_t *subcredentials,
|
||||||
hs_ntor_intro_cell_keys_t *hs_ntor_intro_cell_keys_out);
|
hs_ntor_intro_cell_keys_t *hs_ntor_intro_cell_keys_out);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ compute_introduce_mac(const uint8_t *encoded_cell, size_t encoded_cell_len,
|
|||||||
static hs_ntor_intro_cell_keys_t *
|
static hs_ntor_intro_cell_keys_t *
|
||||||
get_introduce2_key_material(const ed25519_public_key_t *auth_key,
|
get_introduce2_key_material(const ed25519_public_key_t *auth_key,
|
||||||
const curve25519_keypair_t *enc_key,
|
const curve25519_keypair_t *enc_key,
|
||||||
int n_subcredentials,
|
size_t n_subcredentials,
|
||||||
const hs_subcredential_t *subcredentials,
|
const hs_subcredential_t *subcredentials,
|
||||||
const uint8_t *encrypted_section,
|
const uint8_t *encrypted_section,
|
||||||
curve25519_public_key_t *client_pk)
|
curve25519_public_key_t *client_pk)
|
||||||
@ -787,7 +787,7 @@ get_introduce2_keys_and_verify_mac(hs_cell_introduce2_data_t *data,
|
|||||||
/* Validate MAC from the cell and our computed key material. The MAC field
|
/* Validate MAC from the cell and our computed key material. The MAC field
|
||||||
* in the cell is at the end of the encrypted section. */
|
* in the cell is at the end of the encrypted section. */
|
||||||
intro_keys_result = tor_malloc_zero(sizeof(*intro_keys_result));
|
intro_keys_result = tor_malloc_zero(sizeof(*intro_keys_result));
|
||||||
for (int i = 0; i < data->n_subcredentials; ++i) {
|
for (unsigned i = 0; i < data->n_subcredentials; ++i) {
|
||||||
uint8_t mac[DIGEST256_LEN];
|
uint8_t mac[DIGEST256_LEN];
|
||||||
|
|
||||||
/* The MAC field is at the very end of the ENCRYPTED section. */
|
/* The MAC field is at the very end of the ENCRYPTED section. */
|
||||||
|
@ -60,7 +60,7 @@ typedef struct hs_cell_introduce2_data_t {
|
|||||||
/**
|
/**
|
||||||
* Length of the subcredentials array below.
|
* Length of the subcredentials array below.
|
||||||
**/
|
**/
|
||||||
int n_subcredentials;
|
size_t n_subcredentials;
|
||||||
/** Array of <b>n_subcredentials</b> subcredentials for the service. Pointer
|
/** Array of <b>n_subcredentials</b> subcredentials for the service. Pointer
|
||||||
* owned by the descriptor that owns the introduction point through which we
|
* owned by the descriptor that owns the introduction point through which we
|
||||||
* received the INTRO2 cell. */
|
* received the INTRO2 cell. */
|
||||||
|
@ -989,7 +989,7 @@ get_subcredential_for_handling_intro2_cell(const hs_service_t *service,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We are an onionbalance instance: */
|
/* We are an onionbalance instance: */
|
||||||
data->n_subcredentials = (int) service->n_ob_subcreds;
|
data->n_subcredentials = service->n_ob_subcreds;
|
||||||
data->subcredentials = service->ob_subcreds;
|
data->subcredentials = service->ob_subcreds;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -281,7 +281,7 @@ select_array_member_cumulative_timei(const uint64_t *entries, int n_entries,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If <b>s</b> is true, then copy <b>n</b> bytes from <b>src</d> to
|
* If <b>s</b> is true, then copy <b>n</b> bytes from <b>src</b> to
|
||||||
* <b>dest</b>. Otherwise leave <b>dest</b> alone.
|
* <b>dest</b>. Otherwise leave <b>dest</b> alone.
|
||||||
*
|
*
|
||||||
* This function behaves the same as
|
* This function behaves the same as
|
||||||
|
Loading…
Reference in New Issue
Block a user