summaryrefslogtreecommitdiff
path: root/wsutil/pint.h
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-01-27 22:30:34 +0100
committerPeter Wu <peter@lekensteyn.nl>2017-01-28 14:32:09 +0100
commitec9ce3fdad014274ce00de1768f9e11395a77e37 (patch)
tree9c5dd1a5e2c80fa542404594561a17ff3f1a4446 /wsutil/pint.h
parent0d57fe2fe4941acf69d1b5af9b61cc0b10248aa3 (diff)
downloadwireshark-ec9ce3fdad014274ce00de1768f9e11395a77e37.tar.gz
(D)TLS: fix type of record sequence numberTLS13
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
Diffstat (limited to 'wsutil/pint.h')
-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))