From b8917baa6a0f10b3502594ae4e19bcd22e303c8b Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Thu, 27 Apr 2017 15:22:30 -0600 Subject: [PATCH] fix sniffer with AES-GCM, add scratch authTag buffer --- src/sniffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sniffer.c b/src/sniffer.c index 3803c153e..e8d3e344b 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -2206,6 +2206,9 @@ static int Decrypt(SSL* ssl, byte* output, const byte* input, word32 sz) case wolfssl_aes_gcm: if (sz >= (word32)(AESGCM_EXP_IV_SZ + ssl->specs.aead_mac_size)) { + /* scratch buffer, sniffer ignores auth tag*/ + byte authTag[WOLFSSL_MIN_AUTH_TAG_SZ]; + byte nonce[AESGCM_NONCE_SZ]; XMEMCPY(nonce, ssl->keys.aead_dec_imp_IV, AESGCM_IMP_IV_SZ); XMEMCPY(nonce + AESGCM_IMP_IV_SZ, input, AESGCM_EXP_IV_SZ); @@ -2215,7 +2218,7 @@ static int Decrypt(SSL* ssl, byte* output, const byte* input, word32 sz) input + AESGCM_EXP_IV_SZ, sz - AESGCM_EXP_IV_SZ - ssl->specs.aead_mac_size, nonce, AESGCM_NONCE_SZ, - NULL, 0, + authTag, sizeof(authTag), NULL, 0) < 0) { Trace(BAD_DECRYPT); ret = -1;