-# $OpenBSD: Makefile.inc,v 1.58 2018/02/23 15:58:37 markus Exp $
+# $OpenBSD: Makefile.inc,v 1.59 2018/07/09 21:56:06 markus Exp $
.include <bsd.own.mk>
SRCS_PKT+= umac.c
SRCS_PKT+= umac128.c
-.if (${OPENSSL:L} == "yes")
-SRCS_PROT+= bufbn.c
-SRCS_PROT+= bufec.c
-.endif
SRCS_PROT+= channels.c
SRCS_PROT+= crc32.c
SRCS_PROT+= monitor_fdpass.c
+++ /dev/null
-/* $OpenBSD: bufaux.c,v 1.60 2014/04/30 05:29:56 djm Exp $ */
-/*
- * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
-
-#include <sys/types.h>
-
-#include "buffer.h"
-#include "log.h"
-#include "ssherr.h"
-
-int
-buffer_get_short_ret(u_short *v, Buffer *buffer)
-{
- int ret;
-
- if ((ret = sshbuf_get_u16(buffer, v)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-u_short
-buffer_get_short(Buffer *buffer)
-{
- u_short ret;
-
- if (buffer_get_short_ret(&ret, buffer) == -1)
- fatal("%s: buffer error", __func__);
-
- return (ret);
-}
-
-int
-buffer_get_int_ret(u_int *v, Buffer *buffer)
-{
- int ret;
-
- if ((ret = sshbuf_get_u32(buffer, v)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-u_int
-buffer_get_int(Buffer *buffer)
-{
- u_int ret;
-
- if (buffer_get_int_ret(&ret, buffer) == -1)
- fatal("%s: buffer error", __func__);
-
- return (ret);
-}
-
-int
-buffer_get_int64_ret(u_int64_t *v, Buffer *buffer)
-{
- int ret;
-
- if ((ret = sshbuf_get_u64(buffer, v)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-u_int64_t
-buffer_get_int64(Buffer *buffer)
-{
- u_int64_t ret;
-
- if (buffer_get_int64_ret(&ret, buffer) == -1)
- fatal("%s: buffer error", __func__);
-
- return (ret);
-}
-
-void
-buffer_put_short(Buffer *buffer, u_short value)
-{
- int ret;
-
- if ((ret = sshbuf_put_u16(buffer, value)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void
-buffer_put_int(Buffer *buffer, u_int value)
-{
- int ret;
-
- if ((ret = sshbuf_put_u32(buffer, value)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void
-buffer_put_int64(Buffer *buffer, u_int64_t value)
-{
- int ret;
-
- if ((ret = sshbuf_put_u64(buffer, value)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void *
-buffer_get_string_ret(Buffer *buffer, u_int *length_ptr)
-{
- size_t len;
- int ret;
- u_char *value;
-
- if ((ret = sshbuf_get_string(buffer, &value, &len)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return NULL;
- }
- if (length_ptr != NULL)
- *length_ptr = len; /* Safe: sshbuf never stores len > 2^31 */
- return value;
-}
-
-void *
-buffer_get_string(Buffer *buffer, u_int *length_ptr)
-{
- void *ret;
-
- if ((ret = buffer_get_string_ret(buffer, length_ptr)) == NULL)
- fatal("%s: buffer error", __func__);
- return (ret);
-}
-
-char *
-buffer_get_cstring_ret(Buffer *buffer, u_int *length_ptr)
-{
- size_t len;
- int ret;
- char *value;
-
- if ((ret = sshbuf_get_cstring(buffer, &value, &len)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return NULL;
- }
- if (length_ptr != NULL)
- *length_ptr = len; /* Safe: sshbuf never stores len > 2^31 */
- return value;
-}
-
-char *
-buffer_get_cstring(Buffer *buffer, u_int *length_ptr)
-{
- char *ret;
-
- if ((ret = buffer_get_cstring_ret(buffer, length_ptr)) == NULL)
- fatal("%s: buffer error", __func__);
- return ret;
-}
-
-const void *
-buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr)
-{
- size_t len;
- int ret;
- const u_char *value;
-
- if ((ret = sshbuf_get_string_direct(buffer, &value, &len)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return NULL;
- }
- if (length_ptr != NULL)
- *length_ptr = len; /* Safe: sshbuf never stores len > 2^31 */
- return value;
-}
-
-const void *
-buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr)
-{
- const void *ret;
-
- if ((ret = buffer_get_string_ptr_ret(buffer, length_ptr)) == NULL)
- fatal("%s: buffer error", __func__);
- return (ret);
-}
-
-void
-buffer_put_string(Buffer *buffer, const void *buf, u_int len)
-{
- int ret;
-
- if ((ret = sshbuf_put_string(buffer, buf, len)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void
-buffer_put_cstring(Buffer *buffer, const char *s)
-{
- int ret;
-
- if ((ret = sshbuf_put_cstring(buffer, s)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-int
-buffer_get_char_ret(char *v, Buffer *buffer)
-{
- int ret;
-
- if ((ret = sshbuf_get_u8(buffer, (u_char *)v)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-int
-buffer_get_char(Buffer *buffer)
-{
- char ch;
-
- if (buffer_get_char_ret(&ch, buffer) == -1)
- fatal("%s: buffer error", __func__);
- return (u_char) ch;
-}
-
-void
-buffer_put_char(Buffer *buffer, int value)
-{
- int ret;
-
- if ((ret = sshbuf_put_u8(buffer, value)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void
-buffer_put_bignum2_from_string(Buffer *buffer, const u_char *s, u_int l)
-{
- int ret;
-
- if ((ret = sshbuf_put_bignum2_bytes(buffer, s, l)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
+++ /dev/null
-/* $OpenBSD: bufbn.c,v 1.13 2017/04/30 23:23:54 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
-
-#include <sys/types.h>
-
-#include "buffer.h"
-#include "log.h"
-#include "ssherr.h"
-
-
-int
-buffer_put_bignum2_ret(Buffer *buffer, const BIGNUM *value)
-{
- int ret;
-
- if ((ret = sshbuf_put_bignum2(buffer, value)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-void
-buffer_put_bignum2(Buffer *buffer, const BIGNUM *value)
-{
- if (buffer_put_bignum2_ret(buffer, value) == -1)
- fatal("%s: buffer error", __func__);
-}
-
-int
-buffer_get_bignum2_ret(Buffer *buffer, BIGNUM *value)
-{
- int ret;
-
- if ((ret = sshbuf_get_bignum2(buffer, value)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-void
-buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
-{
- if (buffer_get_bignum2_ret(buffer, value) == -1)
- fatal("%s: buffer error", __func__);
-}
+++ /dev/null
-/* $OpenBSD: bufec.c,v 1.4 2014/04/30 05:29:56 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
-
-#include <sys/types.h>
-
-#include "buffer.h"
-#include "log.h"
-#include "ssherr.h"
-
-int
-buffer_put_ecpoint_ret(Buffer *buffer, const EC_GROUP *curve,
- const EC_POINT *point)
-{
- int ret;
-
- if ((ret = sshbuf_put_ec(buffer, point, curve)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-void
-buffer_put_ecpoint(Buffer *buffer, const EC_GROUP *curve,
- const EC_POINT *point)
-{
- if (buffer_put_ecpoint_ret(buffer, curve, point) == -1)
- fatal("%s: buffer error", __func__);
-}
-
-int
-buffer_get_ecpoint_ret(Buffer *buffer, const EC_GROUP *curve,
- EC_POINT *point)
-{
- int ret;
-
- if ((ret = sshbuf_get_ec(buffer, point, curve)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-void
-buffer_get_ecpoint(Buffer *buffer, const EC_GROUP *curve,
- EC_POINT *point)
-{
- if (buffer_get_ecpoint_ret(buffer, curve, point) == -1)
- fatal("%s: buffer error", __func__);
-}
-
-
+++ /dev/null
-/* $OpenBSD: buffer.c,v 1.36 2014/04/30 05:29:56 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
-
-#include <sys/types.h>
-
-#include "buffer.h"
-#include "log.h"
-#include "ssherr.h"
-
-void
-buffer_append(Buffer *buffer, const void *data, u_int len)
-{
- int ret;
-
- if ((ret = sshbuf_put(buffer, data, len)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void *
-buffer_append_space(Buffer *buffer, u_int len)
-{
- int ret;
- u_char *p;
-
- if ((ret = sshbuf_reserve(buffer, len, &p)) != 0)
- fatal("%s: %s", __func__, ssh_err(ret));
- return p;
-}
-
-int
-buffer_check_alloc(Buffer *buffer, u_int len)
-{
- int ret = sshbuf_check_reserve(buffer, len);
-
- if (ret == 0)
- return 1;
- if (ret == SSH_ERR_NO_BUFFER_SPACE)
- return 0;
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-int
-buffer_get_ret(Buffer *buffer, void *buf, u_int len)
-{
- int ret;
-
- if ((ret = sshbuf_get(buffer, buf, len)) != 0) {
- error("%s: %s", __func__, ssh_err(ret));
- return -1;
- }
- return 0;
-}
-
-void
-buffer_get(Buffer *buffer, void *buf, u_int len)
-{
- if (buffer_get_ret(buffer, buf, len) == -1)
- fatal("%s: buffer error", __func__);
-}
-
-int
-buffer_consume_ret(Buffer *buffer, u_int bytes)
-{
- int ret = sshbuf_consume(buffer, bytes);
-
- if (ret == 0)
- return 0;
- if (ret == SSH_ERR_MESSAGE_INCOMPLETE)
- return -1;
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void
-buffer_consume(Buffer *buffer, u_int bytes)
-{
- if (buffer_consume_ret(buffer, bytes) == -1)
- fatal("%s: buffer error", __func__);
-}
-
-int
-buffer_consume_end_ret(Buffer *buffer, u_int bytes)
-{
- int ret = sshbuf_consume_end(buffer, bytes);
-
- if (ret == 0)
- return 0;
- if (ret == SSH_ERR_MESSAGE_INCOMPLETE)
- return -1;
- fatal("%s: %s", __func__, ssh_err(ret));
-}
-
-void
-buffer_consume_end(Buffer *buffer, u_int bytes)
-{
- if (buffer_consume_end_ret(buffer, bytes) == -1)
- fatal("%s: buffer error", __func__);
-}
-
-
+++ /dev/null
-/* $OpenBSD: buffer.h,v 1.26 2017/04/30 23:23:54 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
-
-#ifndef BUFFER_H
-#define BUFFER_H
-
-#include "sshbuf.h"
-
-typedef struct sshbuf Buffer;
-
-#define buffer_init(b) sshbuf_init(b)
-#define buffer_clear(b) sshbuf_reset(b)
-#define buffer_free(b) sshbuf_free(b)
-#define buffer_dump(b) sshbuf_dump(b, stderr)
-
-/* XXX cast is safe: sshbuf never stores more than len 2^31 */
-#define buffer_len(b) ((u_int) sshbuf_len(b))
-#define buffer_ptr(b) sshbuf_mutable_ptr(b)
-
-void buffer_append(Buffer *, const void *, u_int);
-void *buffer_append_space(Buffer *, u_int);
-int buffer_check_alloc(Buffer *, u_int);
-void buffer_get(Buffer *, void *, u_int);
-
-void buffer_consume(Buffer *, u_int);
-void buffer_consume_end(Buffer *, u_int);
-
-
-int buffer_get_ret(Buffer *, void *, u_int);
-int buffer_consume_ret(Buffer *, u_int);
-int buffer_consume_end_ret(Buffer *, u_int);
-
-void buffer_put_bignum2(Buffer *, const BIGNUM *);
-void buffer_get_bignum2(Buffer *, BIGNUM *);
-void buffer_put_bignum2_from_string(Buffer *, const u_char *, u_int);
-
-u_short buffer_get_short(Buffer *);
-void buffer_put_short(Buffer *, u_short);
-
-u_int buffer_get_int(Buffer *);
-void buffer_put_int(Buffer *, u_int);
-
-u_int64_t buffer_get_int64(Buffer *);
-void buffer_put_int64(Buffer *, u_int64_t);
-
-int buffer_get_char(Buffer *);
-void buffer_put_char(Buffer *, int);
-
-void *buffer_get_string(Buffer *, u_int *);
-const void *buffer_get_string_ptr(Buffer *, u_int *);
-void buffer_put_string(Buffer *, const void *, u_int);
-char *buffer_get_cstring(Buffer *, u_int *);
-void buffer_put_cstring(Buffer *, const char *);
-
-#define buffer_skip_string(b) (void)buffer_get_string_ptr(b, NULL);
-
-int buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
-int buffer_get_bignum2_ret(Buffer *, BIGNUM *);
-int buffer_get_short_ret(u_short *, Buffer *);
-int buffer_get_int_ret(u_int *, Buffer *);
-int buffer_get_int64_ret(u_int64_t *, Buffer *);
-void *buffer_get_string_ret(Buffer *, u_int *);
-char *buffer_get_cstring_ret(Buffer *, u_int *);
-const void *buffer_get_string_ptr_ret(Buffer *, u_int *);
-int buffer_get_char_ret(char *, Buffer *);
-
-int buffer_put_ecpoint_ret(Buffer *, const EC_GROUP *, const EC_POINT *);
-void buffer_put_ecpoint(Buffer *, const EC_GROUP *, const EC_POINT *);
-int buffer_get_ecpoint_ret(Buffer *, const EC_GROUP *, EC_POINT *);
-void buffer_get_ecpoint(Buffer *, const EC_GROUP *, EC_POINT *);
-
-#endif /* BUFFER_H */
-
-/* $OpenBSD: kex.h,v 1.88 2018/07/09 13:37:10 sf Exp $ */
+/* $OpenBSD: kex.h,v 1.89 2018/07/09 21:56:06 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
#define KEX_H
#include "mac.h"
-#include "buffer.h" /* XXX for typedef */
#include "key.h" /* XXX for typedef */
#ifdef WITH_LEAKMALLOC
-# $OpenBSD: Makefile,v 1.28 2018/01/08 15:37:26 markus Exp $
+# $OpenBSD: Makefile,v 1.29 2018/07/09 21:56:06 markus Exp $
.PATH: ${.CURDIR}/..
SRCS= ssh-agent.c ssh-pkcs11-client.c
-SRCS+= atomicio.c bufaux.c buffer.c compat.c fatal.c key.c readpass.c
+SRCS+= atomicio.c compat.c fatal.c key.c readpass.c
SRCS+= ${SRCS_BASE} ${SRCS_KEY} ${SRCS_KEYP} ${SRCS_KRL} ${SRCS_UTL}
PROG= ssh-agent
BINOWN= root
-# $OpenBSD: Makefile,v 1.6 2018/01/08 15:37:38 markus Exp $
+# $OpenBSD: Makefile,v 1.7 2018/07/09 21:56:06 markus Exp $
.PATH: ${.CURDIR}/..
SRCS= ssh-pkcs11-helper.c ssh-pkcs11.c
-SRCS+= atomicio.c bufaux.c buffer.c compat.c fatal.c readpass.c
+SRCS+= atomicio.c compat.c fatal.c readpass.c
SRCS+= ${SRCS_KEY} ${SRCS_UTL} ${SRCS_BASE}
PROG= ssh-pkcs11-helper
-# $OpenBSD: Makefile,v 1.72 2018/01/08 15:37:38 markus Exp $
+# $OpenBSD: Makefile,v 1.73 2018/07/09 21:56:06 markus Exp $
.PATH: ${.CURDIR}/..
SRCS= ssh.c readconf.c clientloop.c sshtty.c sshconnect.c sshconnect2.c mux.c
-SRCS+= atomicio.c authfd.c bufaux.c buffer.c compat.c dns.c fatal.c \
+SRCS+= atomicio.c authfd.c compat.c dns.c fatal.c \
hostfile.c key.c msg.c readpass.c utf8.c
SRCS+= ${SRCS_BASE} ${SRCS_KEX} ${SRCS_KEXC} ${SRCS_KEY} ${SRCS_KEYP} \
${SRCS_KRL} ${SRCS_PROT} ${SRCS_PKT} ${SRCS_UTL} ${SRCS_PKCS11}
-/* $OpenBSD: sshbuf.c,v 1.11 2017/06/01 06:58:25 djm Exp $ */
+/* $OpenBSD: sshbuf.c,v 1.12 2018/07/09 21:56:06 markus Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
(!buf->readonly && buf->d != buf->cd) ||
buf->refcount < 1 || buf->refcount > SSHBUF_REFS_MAX ||
buf->cd == NULL ||
- (buf->dont_free && (buf->readonly || buf->parent != NULL)) ||
buf->max_size > SSHBUF_SIZE_MAX ||
buf->alloc > buf->max_size ||
buf->size > buf->alloc ||
return ret;
}
-void
-sshbuf_init(struct sshbuf *ret)
-{
- explicit_bzero(ret, sizeof(*ret));
- ret->alloc = SSHBUF_SIZE_INIT;
- ret->max_size = SSHBUF_SIZE_MAX;
- ret->readonly = 0;
- ret->dont_free = 1;
- ret->refcount = 1;
- if ((ret->cd = ret->d = calloc(1, ret->alloc)) == NULL)
- ret->alloc = 0;
-}
-
void
sshbuf_free(struct sshbuf *buf)
{
- int dont_free = 0;
-
if (buf == NULL)
return;
/*
buf->refcount--;
if (buf->refcount > 0)
return;
- dont_free = buf->dont_free;
if (!buf->readonly) {
explicit_bzero(buf->d, buf->alloc);
free(buf->d);
}
explicit_bzero(buf, sizeof(*buf));
- if (!dont_free)
- free(buf);
+ free(buf);
}
void
-/* $OpenBSD: sshbuf.h,v 1.10 2018/04/10 00:10:49 djm Exp $ */
+/* $OpenBSD: sshbuf.h,v 1.11 2018/07/09 21:56:06 markus Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
struct sshbuf *parent; /* If child, pointer to parent */
};
-#ifndef SSHBUF_NO_DEPREACTED
-/*
- * NB. Please do not use sshbuf_init() in new code. Please use sshbuf_new()
- * instead. sshbuf_init() is deprecated and will go away soon (it is
- * only included to allow compat with buffer_* in OpenSSH)
- */
-void sshbuf_init(struct sshbuf *buf);
-#endif
-
/*
* Create a new sshbuf buffer.
* Returns pointer to buffer on success, or NULL on allocation failure.
-# $OpenBSD: Makefile,v 1.95 2018/01/08 15:37:38 markus Exp $
+# $OpenBSD: Makefile,v 1.96 2018/07/09 21:56:06 markus Exp $
.PATH: ${.CURDIR}/..
groupaccess.c auth-bsdauth.c auth2-hostbased.c auth2-kbdint.c \
auth2-none.c auth2-passwd.c auth2-pubkey.c monitor.c monitor_wrap.c \
sftp-server.c sftp-common.c sandbox-pledge.c
-SRCS+= atomicio.c authfd.c bufaux.c buffer.c compat.c dns.c fatal.c \
+SRCS+= atomicio.c authfd.c compat.c dns.c fatal.c \
hostfile.c key.c msg.c readpass.c utf8.c
SRCS+= ${SRCS_BASE} ${SRCS_KEX} ${SRCS_KEXS} ${SRCS_KEY} ${SRCS_KEYP} \
${SRCS_KRL} ${SRCS_PROT} ${SRCS_PKT} ${SRCS_UTL} ${SRCS_PKCS11}