From 8b0de98bae40cba74a5f4788c03b6ec790bfb090 Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Mon, 9 Jul 2018 21:56:07 +0000 Subject: remove legacy buffer API emulation layer; ok djm@ --- usr.bin/ssh/Makefile.inc | 6 +- usr.bin/ssh/bufaux.c | 257 --------------------------------- usr.bin/ssh/bufbn.c | 64 -------- usr.bin/ssh/bufec.c | 69 --------- usr.bin/ssh/buffer.c | 116 --------------- usr.bin/ssh/buffer.h | 90 ------------ usr.bin/ssh/kex.h | 3 +- usr.bin/ssh/ssh-agent/Makefile | 4 +- usr.bin/ssh/ssh-pkcs11-helper/Makefile | 4 +- usr.bin/ssh/ssh/Makefile | 4 +- usr.bin/ssh/sshbuf.c | 22 +-- usr.bin/ssh/sshbuf.h | 11 +- usr.bin/ssh/sshd/Makefile | 4 +- 13 files changed, 13 insertions(+), 641 deletions(-) delete mode 100644 usr.bin/ssh/bufaux.c delete mode 100644 usr.bin/ssh/bufbn.c delete mode 100644 usr.bin/ssh/bufec.c delete mode 100644 usr.bin/ssh/buffer.c delete mode 100644 usr.bin/ssh/buffer.h diff --git a/usr.bin/ssh/Makefile.inc b/usr.bin/ssh/Makefile.inc index 3d72e8f328c..8e82c64af39 100644 --- a/usr.bin/ssh/Makefile.inc +++ b/usr.bin/ssh/Makefile.inc @@ -1,4 +1,4 @@ -# $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 @@ -101,10 +101,6 @@ SRCS_PKT+= packet.c 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 diff --git a/usr.bin/ssh/bufaux.c b/usr.bin/ssh/bufaux.c deleted file mode 100644 index aa9b892d950..00000000000 --- a/usr.bin/ssh/bufaux.c +++ /dev/null @@ -1,257 +0,0 @@ -/* $OpenBSD: bufaux.c,v 1.60 2014/04/30 05:29:56 djm Exp $ */ -/* - * Copyright (c) 2012 Damien Miller - * - * 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 - -#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/usr.bin/ssh/bufbn.c b/usr.bin/ssh/bufbn.c deleted file mode 100644 index 2f4f728eb0f..00000000000 --- a/usr.bin/ssh/bufbn.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $OpenBSD: bufbn.c,v 1.13 2017/04/30 23:23:54 djm Exp $ */ - -/* - * Copyright (c) 2012 Damien Miller - * - * 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 - -#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__); -} diff --git a/usr.bin/ssh/bufec.c b/usr.bin/ssh/bufec.c deleted file mode 100644 index b33ede38560..00000000000 --- a/usr.bin/ssh/bufec.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $OpenBSD: bufec.c,v 1.4 2014/04/30 05:29:56 djm Exp $ */ - -/* - * Copyright (c) 2012 Damien Miller - * - * 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 - -#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__); -} - - diff --git a/usr.bin/ssh/buffer.c b/usr.bin/ssh/buffer.c deleted file mode 100644 index 07bc186d0c0..00000000000 --- a/usr.bin/ssh/buffer.c +++ /dev/null @@ -1,116 +0,0 @@ -/* $OpenBSD: buffer.c,v 1.36 2014/04/30 05:29:56 djm Exp $ */ - -/* - * Copyright (c) 2012 Damien Miller - * - * 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 - -#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/usr.bin/ssh/buffer.h b/usr.bin/ssh/buffer.h deleted file mode 100644 index 875d8afc9f5..00000000000 --- a/usr.bin/ssh/buffer.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $OpenBSD: buffer.h,v 1.26 2017/04/30 23:23:54 djm Exp $ */ - -/* - * Copyright (c) 2012 Damien Miller - * - * 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 */ - diff --git a/usr.bin/ssh/kex.h b/usr.bin/ssh/kex.h index 2d9258893a0..fa22c1eb5e4 100644 --- a/usr.bin/ssh/kex.h +++ b/usr.bin/ssh/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/usr.bin/ssh/ssh-agent/Makefile b/usr.bin/ssh/ssh-agent/Makefile index 7c7d75d4351..d8d5cb87ebf 100644 --- a/usr.bin/ssh/ssh-agent/Makefile +++ b/usr.bin/ssh/ssh-agent/Makefile @@ -1,9 +1,9 @@ -# $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 diff --git a/usr.bin/ssh/ssh-pkcs11-helper/Makefile b/usr.bin/ssh/ssh-pkcs11-helper/Makefile index 2cd1b1d1357..78da16530e4 100644 --- a/usr.bin/ssh/ssh-pkcs11-helper/Makefile +++ b/usr.bin/ssh/ssh-pkcs11-helper/Makefile @@ -1,9 +1,9 @@ -# $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 diff --git a/usr.bin/ssh/ssh/Makefile b/usr.bin/ssh/ssh/Makefile index ec2de52dc00..c7c89fc31d0 100644 --- a/usr.bin/ssh/ssh/Makefile +++ b/usr.bin/ssh/ssh/Makefile @@ -1,9 +1,9 @@ -# $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} diff --git a/usr.bin/ssh/sshbuf.c b/usr.bin/ssh/sshbuf.c index c4735fe7bd6..90990c310dc 100644 --- a/usr.bin/ssh/sshbuf.c +++ b/usr.bin/ssh/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 * @@ -34,7 +34,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 || @@ -129,24 +128,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; /* @@ -171,14 +155,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/usr.bin/ssh/sshbuf.h b/usr.bin/ssh/sshbuf.h index f4cc4a6bec0..6fd3322891d 100644 --- a/usr.bin/ssh/sshbuf.h +++ b/usr.bin/ssh/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 * @@ -46,15 +46,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. diff --git a/usr.bin/ssh/sshd/Makefile b/usr.bin/ssh/sshd/Makefile index f7b7cbbf73c..8ed0172a1c3 100644 --- a/usr.bin/ssh/sshd/Makefile +++ b/usr.bin/ssh/sshd/Makefile @@ -1,4 +1,4 @@ -# $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}/.. @@ -7,7 +7,7 @@ SRCS= sshd.c auth-rhosts.c auth-passwd.c sshpty.c sshlogin.c servconf.c \ 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} -- cgit v1.2.3