Debian Codegraph @

contrib/mod_sftp/msg.h

raw symbols SCIP
1 /*
2 * ProFTPD - mod_sftp message format
3 * Copyright (c) 2008-2023 TJ Saunders
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 *
19 * As a special exemption, TJ Saunders and other respective copyright holders
20 * give permission to link this program with OpenSSL, and distribute the
21 * resulting executable, without including the source code for OpenSSL in the
22 * source distribution.
23 */
24
25 #ifndef MOD_SFTP_MSG_H
26 #define MOD_SFTP_MSG_H
27
28 #include "mod_sftp.h"
29
30 unsigned char sftp_msg_read_byte(pool *, unsigned char **, uint32_t *);
31 int sftp_msg_read_bool(pool *, unsigned char **, uint32_t *);
32 unsigned char *sftp_msg_read_data(pool *, unsigned char **, uint32_t *, size_t);
33 unsigned char *sftp_msg_read_data_direct(pool *, unsigned char **, uint32_t *,
34 size_t);
35 #if defined(PR_USE_OPENSSL_ECC)
36 EC_POINT *sftp_msg_read_ecpoint(pool *, unsigned char **, uint32_t *,
37 const EC_GROUP *, EC_POINT *);
38 #endif /* PR_USE_OPENSSL_ECC */
39 uint32_t sftp_msg_read_int(pool *, unsigned char **, uint32_t *);
40 uint64_t sftp_msg_read_long(pool *, unsigned char **, uint32_t *);
41 const BIGNUM *sftp_msg_read_mpint(pool *, unsigned char **, uint32_t *);
42 char *sftp_msg_read_string(pool *, unsigned char **, uint32_t *);
43
44 /* Variant of the Message Read API whose return value indicates the number
45 * of bytes of the message actually read. A zero-length return value indicates
46 * failure to read the requested data type.
47 */
48 uint32_t sftp_msg_read_byte2(pool *, unsigned char **, uint32_t *, unsigned char *);
49 uint32_t sftp_msg_read_bool2(pool *, unsigned char **, uint32_t *, int *);
50 uint32_t sftp_msg_read_data2(pool *, unsigned char **, uint32_t *, size_t, unsigned char **);
51 uint32_t sftp_msg_read_data2_direct(pool *, unsigned char **, uint32_t *,
52 size_t, unsigned char **);
53 #if defined(PR_USE_OPENSSL_ECC)
54 uint32_t sftp_msg_read_ecpoint2(pool *, unsigned char **, uint32_t *,
55 const EC_GROUP *, EC_POINT **);
56 #endif /* PR_USE_OPENSSL_ECC */
57 uint32_t sftp_msg_read_int2(pool *, unsigned char **, uint32_t *, uint32_t *);
58 uint32_t sftp_msg_read_long2(pool *, unsigned char **, uint32_t *, uint64_t *);
59 uint32_t sftp_msg_read_mpint2(pool *, unsigned char **, uint32_t *,
60 const BIGNUM **);
61 uint32_t sftp_msg_read_string2(pool *, unsigned char **, uint32_t *, char **);
62
63 uint32_t sftp_msg_write_byte(unsigned char **, uint32_t *, unsigned char);
64 uint32_t sftp_msg_write_bool(unsigned char **, uint32_t *, unsigned char);
65 uint32_t sftp_msg_write_data(unsigned char **, uint32_t *,
66 const unsigned char *, size_t, int);
67 #if defined(PR_USE_OPENSSL_ECC)
68 uint32_t sftp_msg_write_ecpoint(unsigned char **, uint32_t *, const EC_GROUP *,
69 const EC_POINT *);
70 #endif /* PR_USE_OPENSSL_ECC */
71 uint32_t sftp_msg_write_int(unsigned char **, uint32_t *, uint32_t);
72 uint32_t sftp_msg_write_long(unsigned char **, uint32_t *, uint64_t);
73 uint32_t sftp_msg_write_mpint(unsigned char **, uint32_t *, const BIGNUM *);
74 uint32_t sftp_msg_write_string(unsigned char **, uint32_t *, const char *);
75
76 /* Utility method for obtaining a scratch buffer for constructing SSH2
77 * messages without necessarily needing an SSH2 packet.
78 */
79 unsigned char *sftp_msg_getbuf(pool *, size_t);
80
81 #endif /* MOD_SFTP_MSG_H */