X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsptps.c;h=8242cadf096875a202d894c423ac122bd8fd1057;hb=4c30004cb6dc23616d7295b0ce631f066e7f1f82;hp=c22926a84184353ee59fbad823442074dc561a37;hpb=eef25266cb862b5e2c24450d158d99e3cb43e511;p=tinc diff --git a/src/sptps.c b/src/sptps.c index c22926a8..8242cadf 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -1,6 +1,6 @@ /* sptps.c -- Simple Peer-to-Peer Security - Copyright (C) 2011-2012 Guus Sliepen , + Copyright (C) 2011-2013 Guus Sliepen , 2010 Brandon L. Black This program is free software; you can redistribute it and/or modify @@ -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;