Browse Source

prop224: Fix the HS descriptor unittests.

- HS descriptors are now bigger than 10kb.
- encrypted_data_length_is_valid() is not that strict now.
George Kadianakis 7 years ago
parent
commit
1f421d8d47
2 changed files with 2 additions and 10 deletions
  1. 1 1
      src/test/test_hs_cache.c
  2. 1 9
      src/test/test_hs_descriptor.c

+ 1 - 1
src/test/test_hs_cache.c

@@ -333,7 +333,7 @@ helper_fetch_desc_from_hsdir(const ed25519_public_key_t *blinded_key)
     size_t body_used = 0;
 
     fetch_from_buf_http(TO_CONN(conn)->outbuf, &headers, MAX_HEADERS_SIZE,
-                        &received_desc, &body_used, 10000, 0);
+                        &received_desc, &body_used, HS_DESC_MAX_LEN, 0);
     tor_free(headers);
   }
 

+ 1 - 9
src/test/test_hs_descriptor.c

@@ -590,19 +590,11 @@ test_encrypted_data_len(void *arg)
   /* No length, error. */
   ret = encrypted_data_length_is_valid(0);
   tt_int_op(ret, OP_EQ, 0);
-  /* Not a multiple of our encryption algorithm (thus no padding). It's
-   * suppose to be aligned on HS_DESC_PLAINTEXT_PADDING_MULTIPLE. */
-  value = HS_DESC_PLAINTEXT_PADDING_MULTIPLE * 10 - 1;
-  ret = encrypted_data_length_is_valid(value);
-  tt_int_op(ret, OP_EQ, 0);
   /* Valid value. */
-  value = HS_DESC_PADDED_PLAINTEXT_MAX_LEN + HS_DESC_ENCRYPTED_SALT_LEN +
-          DIGEST256_LEN;
+  value = HS_DESC_ENCRYPTED_SALT_LEN + DIGEST256_LEN + 1;
   ret = encrypted_data_length_is_valid(value);
   tt_int_op(ret, OP_EQ, 1);
 
-  /* XXX: Test maximum possible size. */
-
  done:
   ;
 }