Skip to content

Commit 0bac2c2

Browse files
Merge pull request #8846 from lealem47/zd20027
Don't include AEAD nonce in decrypted data size
2 parents 8e9e671 + 53f3e74 commit 0bac2c2

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/sniffer.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6384,10 +6384,31 @@ static int ProcessMessage(const byte* sslFrame, SnifferSession* session,
63846384
Trace(GOT_APP_DATA_STR);
63856385
{
63866386
word32 inOutIdx = 0;
6387+
int ivExtra = 0;
63876388

63886389
ret = DoApplicationData(ssl, (byte*)sslFrame, &inOutIdx, SNIFF);
63896390
if (ret == 0) {
63906391
ret = ssl->buffers.clearOutputBuffer.length;
6392+
#ifndef WOLFSSL_AEAD_ONLY
6393+
if (ssl->specs.cipher_type == block) {
6394+
if (ssl->options.tls1_1)
6395+
ivExtra = ssl->specs.block_size;
6396+
}
6397+
else
6398+
#endif
6399+
if (ssl->specs.cipher_type == aead) {
6400+
if (!ssl->options.tls1_3 &&
6401+
ssl->specs.bulk_cipher_algorithm != wolfssl_chacha)
6402+
ivExtra = AESGCM_EXP_IV_SZ;
6403+
}
6404+
6405+
ret -= ivExtra;;
6406+
6407+
#if defined(HAVE_ENCRYPT_THEN_MAC) && \
6408+
!defined(WOLFSSL_AEAD_ONLY)
6409+
if (ssl->options.startedETMRead)
6410+
ret -= MacSize(ssl);
6411+
#endif
63916412
TraceGotData(ret);
63926413
if (ret) { /* may be blank message */
63936414
if (data != NULL) {

0 commit comments

Comments
 (0)