summaryrefslogtreecommitdiff
path: root/sbin/iked
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-05-23 12:43:27 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-05-23 12:43:27 +0000
commitd7a361a1ae48e1563b802b70589e6b22b040f9be (patch)
treed35c2f02203cd695ea5e08d6069640a10e9f794c /sbin/iked
parent69f2f995ef5d14ec6f33da5b99e202cb097159ab (diff)
There is no need to ibuf_zero() or memset() any buffers.
More cleanup will follow. OK tobhe@
Diffstat (limited to 'sbin/iked')
-rw-r--r--sbin/iked/iked.h3
-rw-r--r--sbin/iked/imsg_util.c34
2 files changed, 5 insertions, 32 deletions
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h
index 6eac02342a3..9750805348e 100644
--- a/sbin/iked/iked.h
+++ b/sbin/iked/iked.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.h,v 1.210 2023/03/05 22:17:22 tobhe Exp $ */
+/* $OpenBSD: iked.h,v 1.211 2023/05/23 12:43:26 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -1282,7 +1282,6 @@ struct ibuf *
ibuf_random(size_t);
int ibuf_prepend(struct ibuf *, void *, size_t);
void *ibuf_advance(struct ibuf *, size_t);
-void ibuf_zero(struct ibuf *);
int ibuf_strcat(struct ibuf **, const char *);
int ibuf_strlen(struct ibuf *);
diff --git a/sbin/iked/imsg_util.c b/sbin/iked/imsg_util.c
index 2f0ee324ed4..65e8ba5df55 100644
--- a/sbin/iked/imsg_util.c
+++ b/sbin/iked/imsg_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg_util.c,v 1.13 2021/05/17 08:14:37 tobhe Exp $ */
+/* $OpenBSD: imsg_util.c,v 1.14 2023/05/23 12:43:26 claudio Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -42,12 +42,6 @@ ibuf_cat(struct ibuf *dst, struct ibuf *src)
return (ibuf_add(dst, src->buf, ibuf_size(src)));
}
-void
-ibuf_zero(struct ibuf *buf)
-{
- explicit_bzero(buf->buf, buf->wpos);
-}
-
struct ibuf *
ibuf_new(const void *data, size_t len)
{
@@ -57,8 +51,6 @@ ibuf_new(const void *data, size_t len)
IKED_MSGBUF_MAX)) == NULL)
return (NULL);
- ibuf_zero(buf);
-
if (len == 0)
return (buf);
@@ -80,37 +72,19 @@ ibuf_new(const void *data, size_t len)
struct ibuf *
ibuf_static(void)
{
- struct ibuf *buf;
-
- if ((buf = ibuf_open(IKED_MSGBUF_MAX)) == NULL)
- return (NULL);
-
- ibuf_zero(buf);
-
- return (buf);
+ return ibuf_open(IKED_MSGBUF_MAX);
}
void *
ibuf_advance(struct ibuf *buf, size_t len)
{
- void *ptr;
-
- if ((ptr = ibuf_reserve(buf, len)) != NULL)
- memset(ptr, 0, len);
-
- return (ptr);
+ return ibuf_reserve(buf, len);
}
void
ibuf_release(struct ibuf *buf)
{
- if (buf == NULL)
- return;
- if (buf->buf != NULL) {
- ibuf_zero(buf);
- free(buf->buf);
- }
- free(buf);
+ ibuf_free(buf);
}
size_t