codekingpro/portable-devtools
115k
1/*2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.3 *4 * Licensed under the Apache License 2.0 (the "License"). You may not use5 * this file except in compliance with the License. You can obtain a copy6 * in the file LICENSE in the source distribution or at7 * https://www.openssl.org/source/license.html8 */9 10#ifndef OPENSSL_BUFFER_H11# define OPENSSL_BUFFER_H12# pragma once13 14# include <openssl/macros.h>15# ifndef OPENSSL_NO_DEPRECATED_3_016# define HEADER_BUFFER_H17# endif18 19# include <openssl/types.h>20# ifndef OPENSSL_CRYPTO_H21# include <openssl/crypto.h>22# endif23# include <openssl/buffererr.h>24 25 26#ifdef __cplusplus27extern "C" {28#endif29 30# include <stddef.h>31# include <sys/types.h>32 33# ifndef OPENSSL_NO_DEPRECATED_3_034# define BUF_strdup(s) OPENSSL_strdup(s)35# define BUF_strndup(s, size) OPENSSL_strndup(s, size)36# define BUF_memdup(data, size) OPENSSL_memdup(data, size)37# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)38# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)39# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)40# endif41 42struct buf_mem_st {43 size_t length; /* current number of bytes */44 char *data;45 size_t max; /* size of buffer */46 unsigned long flags;47};48 49# define BUF_MEM_FLAG_SECURE 0x0150 51BUF_MEM *BUF_MEM_new(void);52BUF_MEM *BUF_MEM_new_ex(unsigned long flags);53void BUF_MEM_free(BUF_MEM *a);54size_t BUF_MEM_grow(BUF_MEM *str, size_t len);55size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);56void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);57 58 59# ifdef __cplusplus60}61# endif62#endif63 