From 290197ba3ee72245fdab5e971c8de43a82b19874 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 1 Jul 2020 23:32:43 +0200 Subject: [PATCH] Add comments on wrong alignment --- .../xchacha20poly1305/secretstream_xchacha20poly1305.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c b/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c index 2754a91c..aa5a3459 100644 --- a/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c +++ b/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c @@ -148,6 +148,7 @@ crypto_secretstream_xchacha20poly1305_push crypto_onetimeauth_poly1305_update(&poly1305_state, c, mlen); crypto_onetimeauth_poly1305_update (&poly1305_state, _pad0, (0x10 - (sizeof block) + mlen) & 0xf); + /* should have been (0x10 - (sizeof block + mlen)) & 0xf to keep input blocks aligned */ STORE64_LE(slen, (uint64_t) adlen); crypto_onetimeauth_poly1305_update(&poly1305_state, slen, sizeof slen); @@ -224,6 +225,7 @@ crypto_secretstream_xchacha20poly1305_pull crypto_onetimeauth_poly1305_update(&poly1305_state, c, mlen); crypto_onetimeauth_poly1305_update (&poly1305_state, _pad0, (0x10 - (sizeof block) + mlen) & 0xf); + /* should have been (0x10 - (sizeof block + mlen)) & 0xf to keep input blocks aligned */ STORE64_LE(slen, (uint64_t) adlen); crypto_onetimeauth_poly1305_update(&poly1305_state, slen, sizeof slen);