]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
6738bf14 | 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. |
0f113f3e | 3 | * |
48f4ad77 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
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 | ||
ae4186b0 DMSP |
10 | #ifndef OPENSSL_BUFFER_H |
11 | # define OPENSSL_BUFFER_H | |
d02b48c6 | 12 | |
50cd4768 | 13 | # include <openssl/types.h> |
ae4186b0 | 14 | # ifndef OPENSSL_CRYPTO_H |
7644a9ae RS |
15 | # include <openssl/crypto.h> |
16 | # endif | |
52df25cf | 17 | # include <openssl/buffererr.h> |
7644a9ae | 18 | |
d6dda126 | 19 | |
d02b48c6 RE |
20 | #ifdef __cplusplus |
21 | extern "C" { | |
22 | #endif | |
23 | ||
0f113f3e | 24 | # include <stddef.h> |
b379fe6c | 25 | # include <sys/types.h> |
54a656ef | 26 | |
7644a9ae RS |
27 | /* |
28 | * These names are outdated as of OpenSSL 1.1; a future release | |
29 | * will move them to be deprecated. | |
30 | */ | |
31 | # define BUF_strdup(s) OPENSSL_strdup(s) | |
32 | # define BUF_strndup(s, size) OPENSSL_strndup(s, size) | |
33 | # define BUF_memdup(data, size) OPENSSL_memdup(data, size) | |
34 | # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) | |
35 | # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) | |
36 | # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) | |
02e112a8 | 37 | |
0f113f3e MC |
38 | struct buf_mem_st { |
39 | size_t length; /* current number of bytes */ | |
40 | char *data; | |
41 | size_t max; /* size of buffer */ | |
74924dcb | 42 | unsigned long flags; |
0f113f3e | 43 | }; |
d02b48c6 | 44 | |
74924dcb RS |
45 | # define BUF_MEM_FLAG_SECURE 0x01 |
46 | ||
d02b48c6 | 47 | BUF_MEM *BUF_MEM_new(void); |
74924dcb | 48 | BUF_MEM *BUF_MEM_new_ex(unsigned long flags); |
0f113f3e | 49 | void BUF_MEM_free(BUF_MEM *a); |
e5bf3c92 DSH |
50 | size_t BUF_MEM_grow(BUF_MEM *str, size_t len); |
51 | size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); | |
b6981744 | 52 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); |
d02b48c6 | 53 | |
6d311938 | 54 | |
0cd0a820 | 55 | # ifdef __cplusplus |
d02b48c6 | 56 | } |
0cd0a820 | 57 | # endif |
d02b48c6 | 58 | #endif |