1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef HEADER_BUFFER_H
11# define HEADER_BUFFER_H
12
13# include <openssl/ossl_typ.h>
14# ifndef HEADER_CRYPTO_H
15# include <openssl/crypto.h>
16# endif
17
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23# include <stddef.h>
24# include <sys/types.h>
25
26/*
27 * These names are outdated as of OpenSSL 1.1; a future release
28 * will move them to be deprecated.
29 */
30# define BUF_strdup(s) OPENSSL_strdup(s)
31# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
32# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
33# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
34# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
35# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
36
37struct buf_mem_st {
38 size_t length; /* current number of bytes */
39 char *data;
40 size_t max; /* size of buffer */
41 unsigned long flags;
42};
43
44# define BUF_MEM_FLAG_SECURE 0x01
45
46BUF_MEM *BUF_MEM_new(void);
47BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
48void BUF_MEM_free(BUF_MEM *a);
49size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
50size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
51void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
52
53/* BEGIN ERROR CODES */
54/*
55 * The following lines are auto generated by the script mkerr.pl. Any changes
56 * made after this point may be overwritten when the script is next run.
57 */
58
59int ERR_load_BUF_strings(void);
60
61/* Error codes for the BUF functions. */
62
63/* Function codes. */
64# define BUF_F_BUF_MEM_GROW 100
65# define BUF_F_BUF_MEM_GROW_CLEAN 105
66# define BUF_F_BUF_MEM_NEW 101
67
68/* Reason codes. */
69
70# ifdef __cplusplus
71}
72# endif
73#endif
74