[openssh-commits] [openssh] 14/19: upstream: remove legacy buffer API emulation layer; ok djm@

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jul 10 19:46:54 AEST 2018


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit cb30cd47041edb03476be1c8ef7bc1f4b69d1555
Author: markus at openbsd.org <markus at openbsd.org>
Date:   Mon Jul 9 21:56:06 2018 +0000

    upstream: remove legacy buffer API emulation layer; ok djm@
    
    OpenBSD-Commit-ID: 2dd5dc17cbc23195be4299fa93be2707a0e08ad9
---
 Makefile.in |   4 +-
 bufaux.c    | 259 ------------------------------------------------------------
 bufbn.c     |  69 ----------------
 bufec.c     |  74 -----------------
 buffer.c    | 118 ---------------------------
 buffer.h    |  95 ----------------------
 kex.h       |   3 +-
 sshbuf.c    |  22 +-----
 sshbuf.h    |  11 +--
 9 files changed, 6 insertions(+), 649 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 2cd48553..277418cf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -84,7 +84,7 @@ LIBOPENSSH_OBJS=\
 	${XMSS_OBJS}
 
 LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
-	authfd.o authfile.o bufaux.o bufbn.o bufec.o buffer.o \
+	authfd.o authfile.o \
 	canohost.o channels.o cipher.o cipher-aes.o cipher-aesctr.o \
 	cipher-ctr.o cleanup.o \
 	compat.o crc32.o fatal.o hostfile.o \
@@ -175,7 +175,7 @@ sshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
 	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS)
 
 scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
-	$(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	$(LD) -o $@ scp.o progressmeter.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
 
 ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
 	$(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
diff --git a/bufaux.c b/bufaux.c
deleted file mode 100644
index 3976896a..00000000
--- a/bufaux.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $OpenBSD: bufaux.c,v 1.60 2014/04/30 05:29:56 djm Exp $ */
-/*
- * Copyright (c) 2012 Damien Miller <djm at 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 "includes.h"
-
-#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));
-}
-
diff --git a/bufbn.c b/bufbn.c
deleted file mode 100644
index 98f9466b..00000000
--- a/bufbn.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: bufbn.c,v 1.13 2017/04/30 23:23:54 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm at 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 "includes.h"
-
-#ifdef WITH_OPENSSL
-
-#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__);
-}
-
-#endif /* WITH_OPENSSL */
diff --git a/bufec.c b/bufec.c
deleted file mode 100644
index 749ce9d4..00000000
--- a/bufec.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: bufec.c,v 1.4 2014/04/30 05:29:56 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm at 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 "includes.h"
-
-#include <sys/types.h>
-
-#include "buffer.h"
-#include "log.h"
-#include "ssherr.h"
-
-#ifdef OPENSSL_HAS_ECC
-
-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__);
-}
-
-#endif /* OPENSSL_HAS_ECC */
-
diff --git a/buffer.c b/buffer.c
deleted file mode 100644
index c5f708ab..00000000
--- a/buffer.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $OpenBSD: buffer.c,v 1.36 2014/04/30 05:29:56 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm at 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 "includes.h"
-
-#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__);
-}
-
-
diff --git a/buffer.h b/buffer.h
deleted file mode 100644
index 56174394..00000000
--- a/buffer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: buffer.h,v 1.26 2017/04/30 23:23:54 djm Exp $ */
-
-/*
- * Copyright (c) 2012 Damien Miller <djm at 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);
-
-#include <openssl/objects.h>
-#include <openssl/bn.h>
-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 *);
-
-#ifdef OPENSSL_HAS_ECC
-#include <openssl/ec.h>
-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
-
-#endif	/* BUFFER_H */
-
diff --git a/kex.h b/kex.h
index e3816047..20900818 100644
--- a/kex.h
+++ b/kex.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -27,7 +27,6 @@
 #define KEX_H
 
 #include "mac.h"
-#include "buffer.h" /* XXX for typedef */
 #include "key.h" /* XXX for typedef */
 
 #ifdef WITH_LEAKMALLOC
diff --git a/sshbuf.c b/sshbuf.c
index de783a36..20ddf9eb 100644
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -1,4 +1,4 @@
-/*	$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
  *
@@ -36,7 +36,6 @@ sshbuf_check_sanity(const struct sshbuf *buf)
 	    (!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 ||
@@ -131,24 +130,9 @@ sshbuf_fromb(struct sshbuf *buf)
 	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;
 	/*
@@ -173,14 +157,12 @@ sshbuf_free(struct sshbuf *buf)
 	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
diff --git a/sshbuf.h b/sshbuf.h
index 25b4e69a..a43598ca 100644
--- a/sshbuf.h
+++ b/sshbuf.h
@@ -1,4 +1,4 @@
-/*	$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
  *
@@ -50,15 +50,6 @@ struct sshbuf {
 	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.

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list