warp-vpn

simple point to point tunnel
git clone git://git.2f30.org/warp-vpn.git
Log | Files | Refs | README

commit 391a2af72fef061e92580d4bc4680cb05f7df461
parent 190deec3928e9323cf2ee8d7200924a17ddba4f9
Author: sin <sin@2f30.org>
Date:   Thu Mar 31 17:27:56 +0100

gcm needs no padding adjust sizes

Diffstat:
stun.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/stun.c b/stun.c @@ -79,11 +79,11 @@ #define NOPRIVUSER "nobody" #define RCVTIMEO 250 /* in milliseconds */ #define RECONNECTTIMEO 60 /* in seconds */ -#define MTU 1412 +#define MTU 1428 #define HDRLEN 2 #define IVLEN 12 #define TAGLEN 16 -#define MAXPKTLEN (TAGLEN + IVLEN + HDRLEN + MTU + AES_BLOCK_SIZE) +#define MAXPKTLEN (TAGLEN + IVLEN + HDRLEN + MTU) #define BADPKT 0x8000 enum { @@ -464,7 +464,7 @@ readdev(int fd, unsigned char *buf, int len) int writenet(int fd, unsigned char *pt, int len) { - unsigned char ct[MTU + AES_BLOCK_SIZE]; + unsigned char ct[MTU]; unsigned char hdr[HDRLEN], iv[IVLEN], tag[TAGLEN]; unsigned char pkt[MAXPKTLEN]; int pktlen; @@ -483,7 +483,7 @@ writenet(int fd, unsigned char *pt, int len) int readnet(int fd, unsigned char *pt, int len) { - unsigned char ct[MTU + AES_BLOCK_SIZE]; + unsigned char ct[MTU]; unsigned char hdr[HDRLEN], iv[IVLEN], tag[TAGLEN]; int n, ctlen; @@ -507,8 +507,8 @@ readnet(int fd, unsigned char *pt, int len) CHECKERR(n); ctlen = unpack16(hdr); - if (ctlen > MTU + AES_BLOCK_SIZE) - ctlen = MTU + AES_BLOCK_SIZE; + if (ctlen > MTU) + ctlen = MTU; n = readall(fd, ct, ctlen); CHECKERR(n); @@ -523,7 +523,7 @@ readnet(int fd, unsigned char *pt, int len) int challenge(int netfd) { - unsigned char buf[MTU + AES_BLOCK_SIZE]; + unsigned char buf[MTU]; struct pollfd pfd[1]; uint64_t n, reply; int ret; @@ -559,7 +559,7 @@ challenge(int netfd) int response(int netfd) { - unsigned char buf[MTU + AES_BLOCK_SIZE]; + unsigned char buf[MTU]; uint64_t reply; int ret; @@ -576,7 +576,7 @@ response(int netfd) int tunnel(int netfd, int devfd) { - unsigned char buf[MTU + AES_BLOCK_SIZE]; + unsigned char buf[MTU]; struct pollfd pfd[2]; int ret, n; @@ -594,7 +594,7 @@ tunnel(int netfd, int devfd) logerr("bad fd in poll set"); if (pfd[0].revents & (POLLIN | POLLHUP)) { - n = readnet(netfd, buf, MTU + AES_BLOCK_SIZE); + n = readnet(netfd, buf, MTU); if (n <= 0) return -1; if (n == BADPKT) {