diff options
author | AmreshVenugopal <amresh.venugopal@gmail.com> | 2019-09-10 01:48:14 +0530 |
---|---|---|
committer | AmreshVenugopal <amresh.venugopal@gmail.com> | 2019-09-23 23:52:01 +0530 |
commit | 3e45260594d3b1c84a88e509f138dab4590903fd (patch) | |
tree | bbb882d40f1c4999c9f781d2faf4a43dc8f6d843 /src/test/fuzz | |
parent | 6846d14868b561e51e5f6afc27a1f1e8a0da94ce (diff) | |
download | tor-3e45260594d3b1c84a88e509f138dab4590903fd.tar.gz tor-3e45260594d3b1c84a88e509f138dab4590903fd.zip |
fix: Ticket #31589
- The function `decrypt_desc_layer` has a cleaner interface.
- `is_superencrypted_layer` changed from `int` -> `bool`
[ticket details](https://trac.torproject.org/projects/tor/ticket/31589)
add(changes/*): changes file
fix(src/features/hs): is_superencrypted changed from `int` -> `bool`
fix(changes/ticket31589): header
add(changes/ticket31589): subsystem(onion services) to change
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/fuzz_hsdescv3.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/test/fuzz/fuzz_hsdescv3.c b/src/test/fuzz/fuzz_hsdescv3.c index 2cbd655898..9d4a6dbb55 100644 --- a/src/test/fuzz/fuzz_hsdescv3.c +++ b/src/test/fuzz/fuzz_hsdescv3.c @@ -35,16 +35,21 @@ mock_rsa_ed25519_crosscert_check(const uint8_t *crosscert, static size_t mock_decrypt_desc_layer(const hs_descriptor_t *desc, - const uint8_t *encrypted_blob, - size_t encrypted_blob_size, const uint8_t *descriptor_cookie, - int is_superencrypted_layer, + bool is_superencrypted_layer, char **decrypted_out) { (void)is_superencrypted_layer; (void)desc; (void)descriptor_cookie; const size_t overhead = HS_DESC_ENCRYPTED_SALT_LEN + DIGEST256_LEN; + const uint8_t *encrypted_blob = (is_superencrypted_layer) + ? desc->plaintext_data.superencrypted_blob + : desc->superencrypted_data.encrypted_blob; + size_t encrypted_blob_size = (is_superencrypted_layer) + ? desc->plaintext_data.superencrypted_blob_size + : desc->superencrypted_data.encrypted_blob_size; + if (encrypted_blob_size < overhead) return 0; *decrypted_out = tor_memdup_nulterm( |