]>
Commit | Line | Data |
---|---|---|
21dcbebc RS |
1 | /* |
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. | |
0f113f3e | 3 | * |
21dcbebc RS |
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 | |
d02b48c6 RE |
8 | */ |
9 | ||
10 | #ifndef HEADER_BUFFER_H | |
0f113f3e | 11 | # define HEADER_BUFFER_H |
d02b48c6 | 12 | |
0f113f3e | 13 | # include <openssl/ossl_typ.h> |
7644a9ae RS |
14 | # ifndef HEADER_CRYPTO_H |
15 | # include <openssl/crypto.h> | |
16 | # endif | |
17 | ||
d6dda126 | 18 | |
d02b48c6 RE |
19 | #ifdef __cplusplus |
20 | extern "C" { | |
21 | #endif | |
22 | ||
0f113f3e | 23 | # include <stddef.h> |
4d8743f4 | 24 | |
0f113f3e MC |
25 | # if !defined(NO_SYS_TYPES_H) |
26 | # include <sys/types.h> | |
27 | # endif | |
54a656ef | 28 | |
7644a9ae RS |
29 | /* |
30 | * These names are outdated as of OpenSSL 1.1; a future release | |
31 | * will move them to be deprecated. | |
32 | */ | |
33 | # define BUF_strdup(s) OPENSSL_strdup(s) | |
34 | # define BUF_strndup(s, size) OPENSSL_strndup(s, size) | |
35 | # define BUF_memdup(data, size) OPENSSL_memdup(data, size) | |
36 | # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) | |
37 | # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) | |
38 | # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) | |
39 | ||
0f113f3e MC |
40 | struct buf_mem_st { |
41 | size_t length; /* current number of bytes */ | |
42 | char *data; | |
43 | size_t max; /* size of buffer */ | |
74924dcb | 44 | unsigned long flags; |
0f113f3e | 45 | }; |
d02b48c6 | 46 | |
74924dcb RS |
47 | # define BUF_MEM_FLAG_SECURE 0x01 |
48 | ||
d02b48c6 | 49 | BUF_MEM *BUF_MEM_new(void); |
74924dcb | 50 | BUF_MEM *BUF_MEM_new_ex(unsigned long flags); |
0f113f3e | 51 | void BUF_MEM_free(BUF_MEM *a); |
e5bf3c92 DSH |
52 | size_t BUF_MEM_grow(BUF_MEM *str, size_t len); |
53 | size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); | |
b6981744 | 54 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); |
d02b48c6 | 55 | |
d02b48c6 | 56 | /* BEGIN ERROR CODES */ |
0f113f3e MC |
57 | /* |
58 | * The following lines are auto generated by the script mkerr.pl. Any changes | |
6d311938 DSH |
59 | * made after this point may be overwritten when the script is next run. |
60 | */ | |
b476df64 | 61 | void ERR_load_BUF_strings(void); |
6d311938 | 62 | |
d02b48c6 RE |
63 | /* Error codes for the BUF functions. */ |
64 | ||
65 | /* Function codes. */ | |
0f113f3e MC |
66 | # define BUF_F_BUF_MEM_GROW 100 |
67 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 | |
68 | # define BUF_F_BUF_MEM_NEW 101 | |
d02b48c6 RE |
69 | |
70 | /* Reason codes. */ | |
6d311938 | 71 | |
d02b48c6 RE |
72 | #ifdef __cplusplus |
73 | } | |
74 | #endif | |
75 | #endif |