summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshbuf.h
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2020-01-25 23:02:13 +0000
committerdjm <djm@openbsd.org>2020-01-25 23:02:13 +0000
commit62af228467135ddff4a44e5f7a48ca2a03bc8ba3 (patch)
tree6a573e8d853ae4e7bde4b8fbf2cf5f3203bb0a6e /usr.bin/ssh/sshbuf.h
parentMinor cleanup, no functional change: (diff)
downloadwireguard-openbsd-62af228467135ddff4a44e5f7a48ca2a03bc8ba3.tar.xz
wireguard-openbsd-62af228467135ddff4a44e5f7a48ca2a03bc8ba3.zip
factor out reading/writing sshbufs to dedicated functions;
feedback and ok markus@
Diffstat (limited to 'usr.bin/ssh/sshbuf.h')
-rw-r--r--usr.bin/ssh/sshbuf.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshbuf.h b/usr.bin/ssh/sshbuf.h
index 1288b92cc6e..dd194830ef4 100644
--- a/usr.bin/ssh/sshbuf.h
+++ b/usr.bin/ssh/sshbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshbuf.h,v 1.18 2019/09/06 05:23:55 djm Exp $ */
+/* $OpenBSD: sshbuf.h,v 1.19 2020/01/25 23:02:14 djm Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
@@ -292,6 +292,22 @@ sshbuf_find(const struct sshbuf *b, size_t start_offset,
*/
char *sshbuf_dup_string(struct sshbuf *buf);
+/*
+ * Fill a buffer from a file descriptor or filename. Both allocate the
+ * buffer for the caller.
+ */
+int sshbuf_load_fd(int, struct sshbuf **)
+ __attribute__((__nonnull__ (2)));
+int sshbuf_load_file(const char *, struct sshbuf **)
+ __attribute__((__nonnull__ (2)));
+
+/*
+ * Write a buffer to a path, creating/truncating as needed (mode 0644,
+ * subject to umask). The buffer contents are not modified.
+ */
+int sshbuf_write_file(const char *path, struct sshbuf *buf)
+ __attribute__((__nonnull__ (2)));
+
/* Macros for decoding/encoding integers */
#define PEEK_U64(p) \
(((u_int64_t)(((const u_char *)(p))[0]) << 56) | \