From 99aa8035554ddb976348d2a9253ab3653019728d Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Sat, 25 Jan 2020 23:02:13 +0000 Subject: upstream: factor out reading/writing sshbufs to dedicated functions; feedback and ok markus@ OpenBSD-Commit-ID: dc09e5f1950b7acc91b8fdf8015347782d2ecd3d --- sshbuf.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'sshbuf.h') diff --git a/sshbuf.h b/sshbuf.h index ebd64b10..165cd0b1 100644 --- a/sshbuf.h +++ b/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 * @@ -291,6 +291,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) | \ -- cgit v1.2.1