summaryrefslogtreecommitdiff
path: root/sys/crypto/cryptosoft.c
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2007-09-13 21:26:42 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2007-09-13 21:26:42 +0000
commit3454a69c9970cde59eaff98270a9b20a0a0fe163 (patch)
tree33364f0cf53e08323db1a1ee8a7816306d1001fd /sys/crypto/cryptosoft.c
parent183780867808cc69f00f0dabcd596ef8905aa53b (diff)
Here too: Convert MALLOC/FREE to malloc/free and use M_ZERO where applicable.
error spotting and ok krw@
Diffstat (limited to 'sys/crypto/cryptosoft.c')
-rw-r--r--sys/crypto/cryptosoft.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c
index 0a42e570d6c..bf7313d792a 100644
--- a/sys/crypto/cryptosoft.c
+++ b/sys/crypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.c,v 1.47 2007/09/10 22:19:42 henric Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.48 2007/09/13 21:26:41 hshoexer Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -467,7 +467,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw,
* copy in a buffer.
*/
- MALLOC(data, u_int8_t *, crd->crd_len, M_CRYPTO_DATA, M_NOWAIT);
+ data = malloc(crd->crd_len, M_CRYPTO_DATA, M_NOWAIT);
if (data == NULL)
return (EINVAL);
COPYDATA(outtype, buf, crd->crd_skip, crd->crd_len, data);
@@ -477,7 +477,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw,
else
result = cxf->decompress(data, crd->crd_len, &out);
- FREE(data, M_CRYPTO_DATA);
+ free(data, M_CRYPTO_DATA);
if (result == 0)
return EINVAL;
@@ -489,7 +489,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw,
if (crd->crd_flags & CRD_F_COMP) {
if (result > crd->crd_len) {
/* Compression was useless, we lost time */
- FREE(out, M_CRYPTO_DATA);
+ free(out, M_CRYPTO_DATA);
return 0;
}
}
@@ -520,7 +520,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw,
}
}
}
- FREE(out, M_CRYPTO_DATA);
+ free(out, M_CRYPTO_DATA);
return 0;
}
@@ -554,7 +554,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
swcr_sesnum *= 2;
swd = malloc(swcr_sesnum * sizeof(struct swcr_data *),
- M_CRYPTO_DATA, M_NOWAIT);
+ M_CRYPTO_DATA, M_NOWAIT | M_ZERO);
if (swd == NULL) {
/* Reset session number */
if (swcr_sesnum == CRYPTO_SW_SESSIONS)
@@ -564,8 +564,6 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
return ENOBUFS;
}
- bzero(swd, swcr_sesnum * sizeof(struct swcr_data *));
-
/* Copy existing sessions */
if (swcr_sessions) {
bcopy(swcr_sessions, swd,
@@ -580,13 +578,12 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri)
*sid = i;
while (cri) {
- MALLOC(*swd, struct swcr_data *, sizeof(struct swcr_data),
- M_CRYPTO_DATA, M_NOWAIT);
+ swd = malloc(sizeof(struct swcr_data), M_CRYPTO_DATA,
+ M_NOWAIT | M_ZERO);
if (*swd == NULL) {
swcr_freesession(i);
return ENOBUFS;
}
- bzero(*swd, sizeof(struct swcr_data));
switch (cri->cri_alg) {
case CRYPTO_DES_CBC:
@@ -820,7 +817,7 @@ swcr_freesession(u_int64_t tid)
break;
}
- FREE(swd, M_CRYPTO_DATA);
+ free(swd, M_CRYPTO_DATA);
}
return 0;
}