From b3035df88796e0e9058b315791861b03b3b59af7 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 27 Jan 2017 22:30:34 +0100 Subject: (D)TLS: fix type of record sequence number The record sequence number is 64-bit, not 32-bit. This applies to all SSLv3/TLS/DTLS versions. Without this fix, after about four million records, the wrong MAC is calculated (for TLS 1.2) or decryption will fail (for TLS 1.3). Change-Id: I05e5e8bc4229ac443a1b06c5fe984fb885eab1ca Reviewed-on: https://code.wireshark.org/review/19824 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- wsutil/pint.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'wsutil') diff --git a/wsutil/pint.h b/wsutil/pint.h index 02012537ee..ecea5fc94a 100644 --- a/wsutil/pint.h +++ b/wsutil/pint.h @@ -137,6 +137,17 @@ ((guint8*)(p))[3] = (guint8)((v) >> 0); \ } +static inline void phton64(guint8 *p, guint64 v) { + p[0] = (guint8)(v >> 56); + p[1] = (guint8)(v >> 48); + p[2] = (guint8)(v >> 40); + p[3] = (guint8)(v >> 32); + p[4] = (guint8)(v >> 24); + p[5] = (guint8)(v >> 16); + p[6] = (guint8)(v >> 8); + p[7] = (guint8)(v >> 0); +} + /* Subtract two guint32s with respect to wraparound */ #define guint32_wraparound_diff(higher, lower) ((higher>lower)?(higher-lower):(higher+0xffffffff-lower+1)) -- cgit v1.2.1