avoid hardcoded "16" for max AH sum size. use AH_MAXSUMSIZE.

This commit is contained in:
itojun 2002-08-09 07:01:21 +00:00
parent 68e52f0ace
commit ed12d77e43
2 changed files with 9 additions and 9 deletions

View File

@ -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 <sys/cdefs.h>
__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

View File

@ -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 <sys/cdefs.h>
__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;
}
/*