aboutsummaryrefslogtreecommitdiffstats
path: root/src/tweetpipe.c
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2025-10-31 18:21:54 +0100
committerGravatar Tim Segers <tsegers@pm.me>2025-11-01 11:13:39 +0100
commit65cbfdc36700c4df4ae1eb9f94b017164501b28c (patch)
treed3e9c2aaf9260378be22bdc1587017067c4c65e6 /src/tweetpipe.c
parent0aecf90263a2548c5d31c7bce6b978245e2ca16e (diff)
downloadtweetpipe-65cbfdc36700c4df4ae1eb9f94b017164501b28c.tar.gz
Clean up chunk offset definitions
Diffstat (limited to 'src/tweetpipe.c')
-rw-r--r--src/tweetpipe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tweetpipe.c b/src/tweetpipe.c
index 9dd5676..f146cd7 100644
--- a/src/tweetpipe.c
+++ b/src/tweetpipe.c
@@ -65,8 +65,8 @@ stream_encrypt(Context *ctx)
{
unsigned char *const chunk_size_p = ctx->buf;
unsigned char *const chunk_nonce = chunk_size_p + 4;
- unsigned char *const chunk_base = chunk_size_p + 4 + crypto_secretbox_NONCEBYTES - crypto_secretbox_BOXZEROBYTES;
- unsigned char *const chunk_msg = chunk_size_p + 4 + crypto_secretbox_NONCEBYTES - crypto_secretbox_BOXZEROBYTES + crypto_secretbox_ZEROBYTES;
+ unsigned char *const chunk_base = chunk_nonce + crypto_secretbox_NONCEBYTES - crypto_secretbox_BOXZEROBYTES;
+ unsigned char *const chunk_msg = chunk_base + crypto_secretbox_ZEROBYTES;
unsigned char nonce[crypto_secretbox_NONCEBYTES];
uint64_t chunk_id;
ssize_t max_chunk_size;
@@ -105,8 +105,8 @@ stream_decrypt(Context *ctx)
{
unsigned char *const chunk_size_p = ctx->buf;
unsigned char *const chunk_nonce = chunk_size_p + 4;
- unsigned char *const chunk_base = chunk_size_p + 4 + crypto_secretbox_NONCEBYTES - crypto_secretbox_BOXZEROBYTES;
- unsigned char *const chunk_msg = chunk_size_p + 4 + crypto_secretbox_NONCEBYTES - crypto_secretbox_BOXZEROBYTES + crypto_secretbox_ZEROBYTES;
+ unsigned char *const chunk_base = chunk_nonce + crypto_secretbox_NONCEBYTES - crypto_secretbox_BOXZEROBYTES;
+ unsigned char *const chunk_msg = chunk_base + crypto_secretbox_ZEROBYTES;
unsigned char nonce[crypto_secretbox_NONCEBYTES];
uint64_t chunk_id;
ssize_t readnb;