]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make n_subcredentials a size_t .
authorGeorge Kadianakis <desnacked@riseup.net>
Thu, 6 Feb 2020 14:28:21 +0000 (16:28 +0200)
committerGeorge Kadianakis <desnacked@riseup.net>
Tue, 11 Feb 2020 00:13:40 +0000 (02:13 +0200)
Based on David's review.

src/core/crypto/hs_ntor.c
src/core/crypto/hs_ntor.h
src/feature/hs/hs_cell.c
src/feature/hs/hs_cell.h
src/feature/hs/hs_circuit.c
src/lib/ctime/di_ops.c

index 4bd11ef98e9a74d785dec060d1516f2aeea6d0e2..07bcdc566cfa4e1844b43015e790104bed0a7d66 100644 (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]);
index 2ed357f02de60c630653ee4ed8494c0881348839..9a975dd83f2413d94765c571db854c5969539ca1 100644 (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);
 
index 97a1691f16b22b1c6f4bc7cd823feb64b968892c..dd5fefd7e7ad3653235434899d47af8700d7df63 100644 (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. */
index cc2e7b5817b2368655705e43c1c5186b89779878..2b28c44c50e1ac647e14b72b537f623e6668fe72 100644 (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. */
index 97507df9f72233b02e25104951fde0a2fd44794f..fdd226ba79a9d93bcda86f81a587bf712ed07dc1 100644 (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;
index 0859dd8bee97b10af571b3b118a4c503348698d9..e1ac0943fb6b4263ff26b1c6d15be16c70c2eb39 100644 (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