summaryrefslogtreecommitdiff
path: root/buffer.h
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2018-07-09 21:56:06 +0000
committerDamien Miller <djm@mindrot.org>2018-07-10 16:44:17 +1000
commitcb30cd47041edb03476be1c8ef7bc1f4b69d1555 (patch)
treeb6bd48d3ab741d48bbba182dcce30654286c8627 /buffer.h
parent235c7c4e3bf046982c2d8242f30aacffa01073d1 (diff)
upstream: remove legacy buffer API emulation layer; ok djm@
OpenBSD-Commit-ID: 2dd5dc17cbc23195be4299fa93be2707a0e08ad9
Diffstat (limited to 'buffer.h')
-rw-r--r--buffer.h95
1 files changed, 0 insertions, 95 deletions
diff --git a/buffer.h b/buffer.h
deleted file mode 100644
index 56174394c..000000000
--- a/buffer.h
+++ /dev/null
@@ -1,95 +0,0 @@
1/* $OpenBSD: buffer.h,v 1.26 2017/04/30 23:23:54 djm Exp $ */
2
3/*
4 * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
20
21#ifndef BUFFER_H
22#define BUFFER_H
23
24#include "sshbuf.h"
25
26typedef struct sshbuf Buffer;
27
28#define buffer_init(b) sshbuf_init(b)
29#define buffer_clear(b) sshbuf_reset(b)
30#define buffer_free(b) sshbuf_free(b)
31#define buffer_dump(b) sshbuf_dump(b, stderr)
32
33/* XXX cast is safe: sshbuf never stores more than len 2^31 */
34#define buffer_len(b) ((u_int) sshbuf_len(b))
35#define buffer_ptr(b) sshbuf_mutable_ptr(b)
36
37void buffer_append(Buffer *, const void *, u_int);
38void *buffer_append_space(Buffer *, u_int);
39int buffer_check_alloc(Buffer *, u_int);
40void buffer_get(Buffer *, void *, u_int);
41
42void buffer_consume(Buffer *, u_int);
43void buffer_consume_end(Buffer *, u_int);
44
45
46int buffer_get_ret(Buffer *, void *, u_int);
47int buffer_consume_ret(Buffer *, u_int);
48int buffer_consume_end_ret(Buffer *, u_int);
49
50#include <openssl/objects.h>
51#include <openssl/bn.h>
52void buffer_put_bignum2(Buffer *, const BIGNUM *);
53void buffer_get_bignum2(Buffer *, BIGNUM *);
54void buffer_put_bignum2_from_string(Buffer *, const u_char *, u_int);
55
56u_short buffer_get_short(Buffer *);
57void buffer_put_short(Buffer *, u_short);
58
59u_int buffer_get_int(Buffer *);
60void buffer_put_int(Buffer *, u_int);
61
62u_int64_t buffer_get_int64(Buffer *);
63void buffer_put_int64(Buffer *, u_int64_t);
64
65int buffer_get_char(Buffer *);
66void buffer_put_char(Buffer *, int);
67
68void *buffer_get_string(Buffer *, u_int *);
69const void *buffer_get_string_ptr(Buffer *, u_int *);
70void buffer_put_string(Buffer *, const void *, u_int);
71char *buffer_get_cstring(Buffer *, u_int *);
72void buffer_put_cstring(Buffer *, const char *);
73
74#define buffer_skip_string(b) (void)buffer_get_string_ptr(b, NULL);
75
76int buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
77int buffer_get_bignum2_ret(Buffer *, BIGNUM *);
78int buffer_get_short_ret(u_short *, Buffer *);
79int buffer_get_int_ret(u_int *, Buffer *);
80int buffer_get_int64_ret(u_int64_t *, Buffer *);
81void *buffer_get_string_ret(Buffer *, u_int *);
82char *buffer_get_cstring_ret(Buffer *, u_int *);
83const void *buffer_get_string_ptr_ret(Buffer *, u_int *);
84int buffer_get_char_ret(char *, Buffer *);
85
86#ifdef OPENSSL_HAS_ECC
87#include <openssl/ec.h>
88int buffer_put_ecpoint_ret(Buffer *, const EC_GROUP *, const EC_POINT *);
89void buffer_put_ecpoint(Buffer *, const EC_GROUP *, const EC_POINT *);
90int buffer_get_ecpoint_ret(Buffer *, const EC_GROUP *, EC_POINT *);
91void buffer_get_ecpoint(Buffer *, const EC_GROUP *, EC_POINT *);
92#endif
93
94#endif /* BUFFER_H */
95