diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-01-25 23:02:13 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-01-26 10:18:42 +1100 |
commit | 99aa8035554ddb976348d2a9253ab3653019728d (patch) | |
tree | 195dc658a883d04305334be9658ba7b9eba55e94 /sshbuf.h | |
parent | 065064fcf455778b0918f783033b374d4ba37a92 (diff) |
upstream: factor out reading/writing sshbufs to dedicated
functions; feedback and ok markus@
OpenBSD-Commit-ID: dc09e5f1950b7acc91b8fdf8015347782d2ecd3d
Diffstat (limited to 'sshbuf.h')
-rw-r--r-- | sshbuf.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshbuf.h,v 1.18 2019/09/06 05:23:55 djm Exp $ */ | 1 | /* $OpenBSD: sshbuf.h,v 1.19 2020/01/25 23:02:14 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2011 Damien Miller | 3 | * Copyright (c) 2011 Damien Miller |
4 | * | 4 | * |
@@ -291,6 +291,22 @@ sshbuf_find(const struct sshbuf *b, size_t start_offset, | |||
291 | */ | 291 | */ |
292 | char *sshbuf_dup_string(struct sshbuf *buf); | 292 | char *sshbuf_dup_string(struct sshbuf *buf); |
293 | 293 | ||
294 | /* | ||
295 | * Fill a buffer from a file descriptor or filename. Both allocate the | ||
296 | * buffer for the caller. | ||
297 | */ | ||
298 | int sshbuf_load_fd(int, struct sshbuf **) | ||
299 | __attribute__((__nonnull__ (2))); | ||
300 | int sshbuf_load_file(const char *, struct sshbuf **) | ||
301 | __attribute__((__nonnull__ (2))); | ||
302 | |||
303 | /* | ||
304 | * Write a buffer to a path, creating/truncating as needed (mode 0644, | ||
305 | * subject to umask). The buffer contents are not modified. | ||
306 | */ | ||
307 | int sshbuf_write_file(const char *path, struct sshbuf *buf) | ||
308 | __attribute__((__nonnull__ (2))); | ||
309 | |||
294 | /* Macros for decoding/encoding integers */ | 310 | /* Macros for decoding/encoding integers */ |
295 | #define PEEK_U64(p) \ | 311 | #define PEEK_U64(p) \ |
296 | (((u_int64_t)(((const u_char *)(p))[0]) << 56) | \ | 312 | (((u_int64_t)(((const u_char *)(p))[0]) << 56) | \ |