aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-01-27 22:30:34 +0100
committerPeter Wu <peter@lekensteyn.nl>2017-01-29 23:31:29 +0000
commitb3035df88796e0e9058b315791861b03b3b59af7 (patch)
tree3bd634d05efcbf85297c658fda8741a074c75ea0 /wsutil
parent9fb9bc52bbed0b8be199e0f3ea21c6e543cde2ab (diff)
(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 <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/pint.h11
1 files changed, 11 insertions, 0 deletions
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))