Make n_subcredentials a size_t .

Based on David's review.
This commit is contained in:
George Kadianakis 2020-02-06 16:28:21 +02:00
parent ba99287d13
commit 901ed35709
6 changed files with 8 additions and 8 deletions

View File

@ -471,7 +471,7 @@ hs_ntor_service_get_introduce1_keys_multi(
const struct ed25519_public_key_t *intro_auth_pubkey,
const struct curve25519_keypair_t *intro_enc_keypair,
const struct curve25519_public_key_t *client_ephemeral_enc_pubkey,
int n_subcredentials,
size_t n_subcredentials,
const hs_subcredential_t *subcredentials,
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);
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_introduce1_key_material(secret_input, &subcredentials[i],
&hs_ntor_intro_cell_keys_out[i]);

View File

@ -62,7 +62,7 @@ int hs_ntor_service_get_introduce1_keys_multi(
const struct ed25519_public_key_t *intro_auth_pubkey,
const struct curve25519_keypair_t *intro_enc_keypair,
const struct curve25519_public_key_t *client_ephemeral_enc_pubkey,
int n_subcredentials,
size_t n_subcredentials,
const hs_subcredential_t *subcredentials,
hs_ntor_intro_cell_keys_t *hs_ntor_intro_cell_keys_out);

View File

@ -77,7 +77,7 @@ compute_introduce_mac(const uint8_t *encoded_cell, size_t encoded_cell_len,
static hs_ntor_intro_cell_keys_t *
get_introduce2_key_material(const ed25519_public_key_t *auth_key,
const curve25519_keypair_t *enc_key,
int n_subcredentials,
size_t n_subcredentials,
const hs_subcredential_t *subcredentials,
const uint8_t *encrypted_section,
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
* in the cell is at the end of the encrypted section. */
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];
/* The MAC field is at the very end of the ENCRYPTED section. */

View File

@ -60,7 +60,7 @@ typedef struct hs_cell_introduce2_data_t {
/**
* Length of the subcredentials array below.
**/
int n_subcredentials;
size_t n_subcredentials;
/** Array of <b>n_subcredentials</b> subcredentials for the service. Pointer
* owned by the descriptor that owns the introduction point through which we
* received the INTRO2 cell. */

View File

@ -989,7 +989,7 @@ get_subcredential_for_handling_intro2_cell(const hs_service_t *service,
}
/* 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;
return 0;

View File

@ -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.
*
* This function behaves the same as