[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] prop224: Fix the HS descriptor unittests.



commit 1f421d8d47e914bfc826616498c22efbb7289b2e
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date:   Wed Feb 8 14:22:22 2017 +0200

    prop224: Fix the HS descriptor unittests.
    
    - HS descriptors are now bigger than 10kb.
    - encrypted_data_length_is_valid() is not that strict now.
---
 src/test/test_hs_cache.c      |  2 +-
 src/test/test_hs_descriptor.c | 10 +---------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c
index 64fc1c1..8dac3d1 100644
--- a/src/test/test_hs_cache.c
+++ b/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);
   }
 
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 4042e64..bd361be 100644
--- a/src/test/test_hs_descriptor.c
+++ b/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:
   ;
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits