-/* $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>
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 *);
-/* $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>
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)
{
IKED_MSGBUF_MAX)) == NULL)
return (NULL);
- ibuf_zero(buf);
-
if (len == 0)
return (buf);
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