diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-02-24 12:44:34 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-03-13 15:58:28 +0200 |
commit | 61f318b1b0bb1cb55d4f54eab87518a1b093ba08 (patch) | |
tree | 28d0918e4b923df0b686dfce7c29cabdacf06717 /src/or/hs_descriptor.c | |
parent | e6b03151fb98a40f9f039424e3c3e8c99ce41371 (diff) | |
download | tor-61f318b1b0bb1cb55d4f54eab87518a1b093ba08.tar.gz tor-61f318b1b0bb1cb55d4f54eab87518a1b093ba08.zip |
prop224: Rename padding size def to something less confusing.
People felt it could refer to the descriptor header section instead of
the plaintext of the superencrypted section.
Diffstat (limited to 'src/or/hs_descriptor.c')
-rw-r--r-- | src/or/hs_descriptor.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c index d15c16054f..f441fbf03b 100644 --- a/src/or/hs_descriptor.c +++ b/src/or/hs_descriptor.c @@ -558,18 +558,17 @@ static size_t compute_padded_plaintext_length(size_t plaintext_len) { size_t plaintext_padded_len; + const int padding_block_length = HS_DESC_SUPERENC_PLAINTEXT_PAD_MULTIPLE; /* Make sure we won't overflow. */ - tor_assert(plaintext_len <= - (SIZE_T_CEILING - HS_DESC_PLAINTEXT_PADDING_MULTIPLE)); + tor_assert(plaintext_len <= (SIZE_T_CEILING - padding_block_length)); /* Get the extra length we need to add. For example, if srclen is 10200 * bytes, this will expand to (2 * 10k) == 20k thus an extra 9800 bytes. */ - plaintext_padded_len = CEIL_DIV(plaintext_len, - HS_DESC_PLAINTEXT_PADDING_MULTIPLE) * - HS_DESC_PLAINTEXT_PADDING_MULTIPLE; + plaintext_padded_len = CEIL_DIV(plaintext_len, padding_block_length) * + padding_block_length; /* Can never be extra careful. Make sure we are _really_ padded. */ - tor_assert(!(plaintext_padded_len % HS_DESC_PLAINTEXT_PADDING_MULTIPLE)); + tor_assert(!(plaintext_padded_len % padding_block_length)); return plaintext_padded_len; } @@ -619,7 +618,7 @@ build_encrypted(const uint8_t *key, const uint8_t *iv, const char *plaintext, encrypted_len = build_plaintext_padding(plaintext, plaintext_len, &padded_plaintext); /* Extra precautions that we have a valid padding length. */ - tor_assert(!(encrypted_len % HS_DESC_PLAINTEXT_PADDING_MULTIPLE)); + tor_assert(!(encrypted_len % HS_DESC_SUPERENC_PLAINTEXT_PAD_MULTIPLE)); } else { /* No padding required for inner layers */ padded_plaintext = tor_memdup(plaintext, plaintext_len); encrypted_len = plaintext_len; |