diff options
author | David Goulet <dgoulet@torproject.org> | 2017-05-30 10:27:42 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-05-30 10:27:42 -0400 |
commit | 5b33d95a3dfe943625d78983bb53be2901a51150 (patch) | |
tree | 9c28a3511f44a2f03eb9ec302ee5db3e527efcd1 /src/test/test_hs_descriptor.c | |
parent | 83439e78cc08f5a05d314de4409e69aa6d1601d7 (diff) | |
download | tor-5b33d95a3dfe943625d78983bb53be2901a51150.tar.gz tor-5b33d95a3dfe943625d78983bb53be2901a51150.zip |
hs: Correctly validate v3 descriptor encrypted length
The encrypted_data_length_is_valid() function wasn't validating correctly the
length of the encrypted data of a v3 descriptor. The side effect of this is
that an HSDir was rejecting the descriptor and ultimately not storing it.
Fixes #22447
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_hs_descriptor.c')
-rw-r--r-- | src/test/test_hs_descriptor.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c index 02a71aa473..97fe1910b8 100644 --- a/src/test/test_hs_descriptor.c +++ b/src/test/test_hs_descriptor.c @@ -587,9 +587,8 @@ 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; + /* This value is missing data. */ + value = HS_DESC_ENCRYPTED_SALT_LEN + DIGEST256_LEN; ret = encrypted_data_length_is_valid(value); tt_int_op(ret, OP_EQ, 0); /* Valid value. */ |