summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/crypto/crypto.c12
-rw-r--r--sys/crypto/cryptosoft.c33
2 files changed, 19 insertions, 26 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c
index b09ece09ce6..69e929313c7 100644
--- a/sys/crypto/crypto.c
+++ b/sys/crypto/crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crypto.c,v 1.12 2000/07/03 20:38:34 angelos Exp $ */
+/* $OpenBSD: crypto.c,v 1.13 2000/08/19 13:43:23 nate Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -163,9 +163,8 @@ crypto_get_driverid(void)
if (crypto_drivers_num == 0)
{
crypto_drivers_num = CRYPTO_DRIVERS_INITIAL;
- MALLOC(crypto_drivers, struct cryptocap *,
- crypto_drivers_num * sizeof(struct cryptocap), M_XDATA,
- M_NOWAIT);
+ crypto_drivers = malloc(crypto_drivers_num * sizeof(struct cryptocap),
+ M_XDATA, M_NOWAIT);
if (crypto_drivers == NULL)
{
crypto_drivers_num = 0;
@@ -188,9 +187,8 @@ crypto_get_driverid(void)
if (2 * crypto_drivers_num <= crypto_drivers_num)
return -1;
- MALLOC(newdrv, struct cryptocap *,
- 2 * crypto_drivers_num * sizeof(struct cryptocap),
- M_XDATA, M_NOWAIT);
+ newdrv = malloc(2 * crypto_drivers_num * sizeof(struct cryptocap),
+ M_XDATA, M_NOWAIT);
if (newdrv == NULL)
return -1;
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c
index 12107709ae8..98098486706 100644
--- a/sys/crypto/cryptosoft.c
+++ b/sys/crypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.c,v 1.13 2000/07/21 00:02:20 angelos Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.14 2000/08/19 13:43:23 nate Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -399,8 +399,8 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
else
swcr_sesnum *= 2;
- MALLOC(swd, struct swcr_data **,
- swcr_sesnum * sizeof(struct swcr_data *), M_XDATA, M_NOWAIT);
+ swd = malloc(swcr_sesnum * sizeof(struct swcr_data *),
+ M_XDATA, M_NOWAIT);
if (swd == NULL)
{
/* Reset session number */
@@ -419,7 +419,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
{
bcopy(swcr_sessions, swd,
(swcr_sesnum / 2) * sizeof(struct swcr_data *));
- FREE(swcr_sessions, M_XDATA);
+ free(swcr_sessions, M_XDATA);
}
swcr_sessions = swd;
@@ -464,8 +464,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
enccommon:
txf->setkey(&((*swd)->sw_kschedule), cri->cri_key,
cri->cri_klen / 8);
- MALLOC((*swd)->sw_iv, u_int8_t *, txf->blocksize, M_XDATA,
- M_NOWAIT);
+ (*swd)->sw_iv = malloc(txf->blocksize, M_XDATA, M_NOWAIT);
if ((*swd)->sw_iv == NULL)
{
swcr_freesession(i);
@@ -489,16 +488,14 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
axf = &auth_hash_hmac_ripemd_160_96;
authcommon:
- MALLOC((*swd)->sw_ictx, u_int8_t *, axf->ctxsize, M_XDATA,
- M_NOWAIT);
+ (*swd)->sw_ictx = malloc(axf->ctxsize, M_XDATA, M_NOWAIT);
if ((*swd)->sw_ictx == NULL)
{
swcr_freesession(i);
return ENOBUFS;
}
- MALLOC((*swd)->sw_octx, u_int8_t *, axf->ctxsize, M_XDATA,
- M_NOWAIT);
+ (*swd)->sw_octx = malloc(axf->ctxsize, M_XDATA, M_NOWAIT);
if ((*swd)->sw_octx == NULL)
{
swcr_freesession(i);
@@ -537,8 +534,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
axf = &auth_hash_key_sha1;
auth2common:
- MALLOC((*swd)->sw_ictx, u_int8_t *, axf->ctxsize, M_XDATA,
- M_NOWAIT);
+ (*swd)->sw_ictx = malloc(axf->ctxsize, M_XDATA, M_NOWAIT);
if ((*swd)->sw_ictx == NULL)
{
swcr_freesession(i);
@@ -546,8 +542,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
}
/* Store the key so we can "append" it to the payload */
- MALLOC((*swd)->sw_octx, u_int8_t *, cri->cri_klen / 8,
- M_XDATA, M_NOWAIT);
+ (*swd)->sw_octx = malloc(cri->cri_klen / 8, M_XDATA, M_NOWAIT);
if ((*swd)->sw_octx == NULL)
{
swcr_freesession(i);
@@ -614,7 +609,7 @@ swcr_freesession(u_int64_t tid)
txf->zerokey(&(swd->sw_kschedule));
if (swd->sw_iv)
- FREE(swd->sw_iv, M_XDATA);
+ free(swd->sw_iv, M_XDATA);
break;
case CRYPTO_MD5_HMAC96:
@@ -625,13 +620,13 @@ swcr_freesession(u_int64_t tid)
if (swd->sw_ictx)
{
bzero(swd->sw_ictx, axf->ctxsize);
- FREE(swd->sw_ictx, M_XDATA);
+ free(swd->sw_ictx, M_XDATA);
}
if (swd->sw_octx)
{
bzero(swd->sw_octx, axf->ctxsize);
- FREE(swd->sw_octx, M_XDATA);
+ free(swd->sw_octx, M_XDATA);
}
break;
@@ -642,13 +637,13 @@ swcr_freesession(u_int64_t tid)
if (swd->sw_ictx)
{
bzero(swd->sw_ictx, axf->ctxsize);
- FREE(swd->sw_ictx, M_XDATA);
+ free(swd->sw_ictx, M_XDATA);
}
if (swd->sw_octx)
{
bzero(swd->sw_octx, swd->sw_klen);
- FREE(swd->sw_octx, M_XDATA);
+ free(swd->sw_octx, M_XDATA);
}
break;
}