From: Guus Sliepen Date: Mon, 21 Jan 2013 12:47:46 +0000 (+0100) Subject: Fix datagram SPTPS. X-Git-Tag: release-1.1pre6~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3a039ece25198c87e67950f0c4687587bf268075;p=oweals%2Ftinc.git Fix datagram SPTPS. Commit dd07c9fc1f37bed8d1f67ffe7b203f61e7914edf broke the reception of datagram SPTPS packets, by undoing the conversion of the sequence number to host byte order before comparison. This caused error messages like "Packet is 16777215 seqs in the future, dropped (1)". --- diff --git a/src/sptps.c b/src/sptps.c index fe97844..8242cad 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -447,8 +447,6 @@ static bool sptps_receive_data_datagram(sptps_t *s, const char *data, size_t len memcpy(buffer, &netlen, 2); memcpy(buffer + 2, data, len); - memcpy(&seqno, buffer + 2, 4); - if(!digest_verify(&s->indigest, buffer, len - 14, buffer + len - 14)) return error(s, EIO, "Invalid HMAC"); @@ -492,6 +490,7 @@ static bool sptps_receive_data_datagram(sptps_t *s, const char *data, size_t len s->received++; // Decrypt. + memcpy(&seqno, buffer + 2, 4); cipher_set_counter(&s->incipher, &seqno, sizeof seqno); if(!cipher_counter_xor(&s->incipher, buffer + 6, len - 4, buffer + 6)) return false;