diff options
-rw-r--r-- | sys/netinet/ip_ah.c | 18 | ||||
-rw-r--r-- | sys/netinet/ip_esp.c | 13 |
2 files changed, 15 insertions, 16 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 2a6aa667a05..31d9c25bcff 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.90 2007/10/09 01:30:47 krw Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.91 2007/10/17 20:01:26 hshoexer Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -156,8 +156,7 @@ ah_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii) thash->name)); tdbp->tdb_amxkeylen = ii->ii_authkeylen; - MALLOC(tdbp->tdb_amxkey, u_int8_t *, tdbp->tdb_amxkeylen, M_XDATA, - M_WAITOK); + tdbp->tdb_amxkey = malloc(tdbp->tdb_amxkeylen, M_XDATA, M_WAITOK); bcopy(ii->ii_authkey, tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); @@ -180,7 +179,7 @@ ah_zeroize(struct tdb *tdbp) if (tdbp->tdb_amxkey) { bzero(tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); - FREE(tdbp->tdb_amxkey, M_XDATA); + free(tdbp->tdb_amxkey, M_XDATA); tdbp->tdb_amxkey = NULL; } @@ -375,8 +374,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* Let's deal with the remaining headers (if any). */ if (skip - sizeof(struct ip6_hdr) > 0) { if (m->m_len <= skip) { - MALLOC(ptr, unsigned char *, - skip - sizeof(struct ip6_hdr), + ptr = malloc(skip - sizeof(struct ip6_hdr), M_XDATA, M_NOWAIT); if (ptr == NULL) { DPRINTF(("ah_massage_headers(): failed to allocate memory for IPv6 headers\n")); @@ -429,7 +427,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* Free, if we allocated. */ if (alloc) - FREE(ptr, M_XDATA); + free(ptr, M_XDATA); return EINVAL; } @@ -450,7 +448,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* Free, if we allocated. */ if (alloc) - FREE(ptr, M_XDATA); + free(ptr, M_XDATA); return EINVAL; } } @@ -513,7 +511,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) DPRINTF(("ah_massage_headers(): unexpected " "IPv6 header type %d\n", off)); if (alloc) - FREE(ptr, M_XDATA); + free(ptr, M_XDATA); ahstat.ahs_hdrops++; m_freem(m); return EINVAL; @@ -524,7 +522,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) if (alloc) { m_copyback(m, sizeof(struct ip6_hdr), skip - sizeof(struct ip6_hdr), ptr); - FREE(ptr, M_XDATA); + free(ptr, M_XDATA); } break; diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index d4607b9e65d..8c9f45b70a2 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.102 2007/10/06 02:18:38 krw Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.103 2007/10/17 20:01:26 hshoexer Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -76,6 +76,7 @@ #include "bpfilter.h" +#define ENCDEBUG #ifdef ENCDEBUG #define DPRINTF(x) if (encdebug) printf x #else @@ -218,8 +219,8 @@ esp_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii) if (tdbp->tdb_encalgxform) { /* Save the raw keys */ tdbp->tdb_emxkeylen = ii->ii_enckeylen; - MALLOC(tdbp->tdb_emxkey, u_int8_t *, tdbp->tdb_emxkeylen, - M_XDATA, M_WAITOK); + tdbp->tdb_emxkey = malloc(tdbp->tdb_emxkeylen, M_XDATA, + M_WAITOK); bcopy(ii->ii_enckey, tdbp->tdb_emxkey, tdbp->tdb_emxkeylen); bzero(&crie, sizeof(crie)); @@ -239,7 +240,7 @@ esp_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii) if (tdbp->tdb_authalgxform) { /* Save the raw keys */ tdbp->tdb_amxkeylen = ii->ii_authkeylen; - MALLOC(tdbp->tdb_amxkey, u_int8_t *, tdbp->tdb_amxkeylen, M_XDATA, + tdbp->tdb_amxkey = malloc(tdbp->tdb_amxkeylen, M_XDATA, M_WAITOK); bcopy(ii->ii_authkey, tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); @@ -265,13 +266,13 @@ esp_zeroize(struct tdb *tdbp) if (tdbp->tdb_amxkey) { bzero(tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); - FREE(tdbp->tdb_amxkey, M_XDATA); + free(tdbp->tdb_amxkey, M_XDATA); tdbp->tdb_amxkey = NULL; } if (tdbp->tdb_emxkey) { bzero(tdbp->tdb_emxkey, tdbp->tdb_emxkeylen); - FREE(tdbp->tdb_emxkey, M_XDATA); + free(tdbp->tdb_emxkey, M_XDATA); tdbp->tdb_emxkey = NULL; } |