From ed12d77e43ba9af06d61cf3c22b3c61f24974d68 Mon Sep 17 00:00:00 2001 From: itojun Date: Fri, 9 Aug 2002 07:01:21 +0000 Subject: [PATCH] avoid hardcoded "16" for max AH sum size. use AH_MAXSUMSIZE. --- sys/netinet6/ah_output.c | 8 ++++---- sys/netinet6/esp_output.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/netinet6/ah_output.c b/sys/netinet6/ah_output.c index bcafa219c4cb..c4323cdb9ad2 100644 --- a/sys/netinet6/ah_output.c +++ b/sys/netinet6/ah_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: ah_output.c,v 1.17 2002/06/09 14:43:11 itojun Exp $ */ +/* $NetBSD: ah_output.c,v 1.18 2002/08/09 07:01:21 itojun Exp $ */ /* $KAME: ah_output.c,v 1.31 2001/07/26 06:53:15 jinmei Exp $ */ /* @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ah_output.c,v 1.17 2002/06/09 14:43:11 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ah_output.c,v 1.18 2002/08/09 07:01:21 itojun Exp $"); #include "opt_inet.h" @@ -126,9 +126,9 @@ ah_hdrsiz(isr) estimate: /* ASSUMING: * sizeof(struct newah) > sizeof(struct ah). - * 16 = (16 + 3) & ~(4 - 1). + * AH_MAXSUMSIZE is multiple of 4. */ - return sizeof(struct newah) + 16; + return sizeof(struct newah) + AH_MAXSUMSIZE; } #ifdef INET diff --git a/sys/netinet6/esp_output.c b/sys/netinet6/esp_output.c index 8ab51baf7e6a..69b3b937796c 100644 --- a/sys/netinet6/esp_output.c +++ b/sys/netinet6/esp_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_output.c,v 1.14 2002/08/09 06:38:14 itojun Exp $ */ +/* $NetBSD: esp_output.c,v 1.15 2002/08/09 07:01:21 itojun Exp $ */ /* $KAME: esp_output.c,v 1.44 2001/07/26 06:53:15 jinmei Exp $ */ /* @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp_output.c,v 1.14 2002/08/09 06:38:14 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp_output.c,v 1.15 2002/08/09 07:01:21 itojun Exp $"); #include "opt_inet.h" @@ -144,12 +144,12 @@ esp_hdrsiz(isr) * sizeof(struct newesp) > sizeof(struct esp). * esp_max_ivlen() = max ivlen for CBC mode * esp_max_padbound - 1 = - * (maximum padding length without random padding length) + * maximum padding length without random padding length * 2 = (Pad Length field) + (Next Header field). - * 16 = maximum ICV we support. + * AH_MAXSUMSIZE = maximum ICV we support. */ return sizeof(struct newesp) + esp_max_ivlen() + - esp_max_padbound() - 1 + 2 + 16; + esp_max_padbound() - 1 + 2 + AH_MAXSUMSIZE; } /*