commit 901ed35709ac79e841b89d947a0d84526f4d8daf Author: George Kadianakis desnacked@riseup.net Date: Thu Feb 6 16:28:21 2020 +0200
Make n_subcredentials a size_t .
Based on David's review. --- src/core/crypto/hs_ntor.c | 4 ++-- src/core/crypto/hs_ntor.h | 2 +- src/feature/hs/hs_cell.c | 4 ++-- src/feature/hs/hs_cell.h | 2 +- src/feature/hs/hs_circuit.c | 2 +- src/lib/ctime/di_ops.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/core/crypto/hs_ntor.c b/src/core/crypto/hs_ntor.c index 4bd11ef98..07bcdc566 100644 --- a/src/core/crypto/hs_ntor.c +++ b/src/core/crypto/hs_ntor.c @@ -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]); diff --git a/src/core/crypto/hs_ntor.h b/src/core/crypto/hs_ntor.h index 2ed357f02..9a975dd83 100644 --- a/src/core/crypto/hs_ntor.h +++ b/src/core/crypto/hs_ntor.h @@ -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);
diff --git a/src/feature/hs/hs_cell.c b/src/feature/hs/hs_cell.c index 97a1691f1..dd5fefd7e 100644 --- a/src/feature/hs/hs_cell.c +++ b/src/feature/hs/hs_cell.c @@ -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. */ diff --git a/src/feature/hs/hs_cell.h b/src/feature/hs/hs_cell.h index cc2e7b581..2b28c44c5 100644 --- a/src/feature/hs/hs_cell.h +++ b/src/feature/hs/hs_cell.h @@ -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. */ diff --git a/src/feature/hs/hs_circuit.c b/src/feature/hs/hs_circuit.c index 97507df9f..fdd226ba7 100644 --- a/src/feature/hs/hs_circuit.c +++ b/src/feature/hs/hs_circuit.c @@ -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; diff --git a/src/lib/ctime/di_ops.c b/src/lib/ctime/di_ops.c index 0859dd8be..e1ac0943f 100644 --- a/src/lib/ctime/di_ops.c +++ b/src/lib/ctime/di_ops.c @@ -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