You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

buffer.h 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 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. #ifndef OPENSSL_BUFFER_H
  10. #define OPENSSL_BUFFER_H
  11. #pragma once
  12. #include <openssl/macros.h>
  13. #ifndef OPENSSL_NO_DEPRECATED_3_0
  14. #define HEADER_BUFFER_H
  15. #endif
  16. #include <openssl/types.h>
  17. #ifndef OPENSSL_CRYPTO_H
  18. #include <openssl/crypto.h>
  19. #endif
  20. #include <openssl/buffererr.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. #include <stddef.h>
  26. #include <sys/types.h>
  27. #ifndef OPENSSL_NO_DEPRECATED_3_0
  28. #define BUF_strdup(s) OPENSSL_strdup(s)
  29. #define BUF_strndup(s, size) OPENSSL_strndup(s, size)
  30. #define BUF_memdup(data, size) OPENSSL_memdup(data, size)
  31. #define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
  32. #define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
  33. #define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
  34. #endif
  35. struct buf_mem_st
  36. {
  37. size_t length; /* current number of bytes */
  38. char* data;
  39. size_t max; /* size of buffer */
  40. unsigned long flags;
  41. };
  42. #define BUF_MEM_FLAG_SECURE 0x01
  43. BUF_MEM* BUF_MEM_new(void);
  44. BUF_MEM* BUF_MEM_new_ex(unsigned long flags);
  45. void BUF_MEM_free(BUF_MEM* a);
  46. size_t BUF_MEM_grow(BUF_MEM* str, size_t len);
  47. size_t BUF_MEM_grow_clean(BUF_MEM* str, size_t len);
  48. void BUF_reverse(unsigned char* out, const unsigned char* in, size_t siz);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif