jpayne@69
|
1 /*
|
jpayne@69
|
2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
jpayne@69
|
3 *
|
jpayne@69
|
4 * Licensed under the OpenSSL license (the "License"). You may not use
|
jpayne@69
|
5 * this file except in compliance with the License. You can obtain a copy
|
jpayne@69
|
6 * in the file LICENSE in the source distribution or at
|
jpayne@69
|
7 * https://www.openssl.org/source/license.html
|
jpayne@69
|
8 */
|
jpayne@69
|
9
|
jpayne@69
|
10 #ifndef HEADER_BUFFER_H
|
jpayne@69
|
11 # define HEADER_BUFFER_H
|
jpayne@69
|
12
|
jpayne@69
|
13 # include <openssl/ossl_typ.h>
|
jpayne@69
|
14 # ifndef HEADER_CRYPTO_H
|
jpayne@69
|
15 # include <openssl/crypto.h>
|
jpayne@69
|
16 # endif
|
jpayne@69
|
17 # include <openssl/buffererr.h>
|
jpayne@69
|
18
|
jpayne@69
|
19
|
jpayne@69
|
20 #ifdef __cplusplus
|
jpayne@69
|
21 extern "C" {
|
jpayne@69
|
22 #endif
|
jpayne@69
|
23
|
jpayne@69
|
24 # include <stddef.h>
|
jpayne@69
|
25 # include <sys/types.h>
|
jpayne@69
|
26
|
jpayne@69
|
27 /*
|
jpayne@69
|
28 * These names are outdated as of OpenSSL 1.1; a future release
|
jpayne@69
|
29 * will move them to be deprecated.
|
jpayne@69
|
30 */
|
jpayne@69
|
31 # define BUF_strdup(s) OPENSSL_strdup(s)
|
jpayne@69
|
32 # define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
jpayne@69
|
33 # define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
jpayne@69
|
34 # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
jpayne@69
|
35 # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
jpayne@69
|
36 # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
jpayne@69
|
37
|
jpayne@69
|
38 struct buf_mem_st {
|
jpayne@69
|
39 size_t length; /* current number of bytes */
|
jpayne@69
|
40 char *data;
|
jpayne@69
|
41 size_t max; /* size of buffer */
|
jpayne@69
|
42 unsigned long flags;
|
jpayne@69
|
43 };
|
jpayne@69
|
44
|
jpayne@69
|
45 # define BUF_MEM_FLAG_SECURE 0x01
|
jpayne@69
|
46
|
jpayne@69
|
47 BUF_MEM *BUF_MEM_new(void);
|
jpayne@69
|
48 BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
jpayne@69
|
49 void BUF_MEM_free(BUF_MEM *a);
|
jpayne@69
|
50 size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
jpayne@69
|
51 size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
jpayne@69
|
52 void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
jpayne@69
|
53
|
jpayne@69
|
54
|
jpayne@69
|
55 # ifdef __cplusplus
|
jpayne@69
|
56 }
|
jpayne@69
|
57 # endif
|
jpayne@69
|
58 #endif
|