BUF_MEM_new.pod 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. =pod
  2. =head1 NAME
  3. BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow,
  4. BUF_MEM_grow_clean, BUF_reverse
  5. - simple character array structure
  6. standard C library equivalents
  7. =head1 SYNOPSIS
  8. #include <openssl/buffer.h>
  9. BUF_MEM *BUF_MEM_new(void);
  10. BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
  11. void BUF_MEM_free(BUF_MEM *a);
  12. int BUF_MEM_grow(BUF_MEM *str, int len);
  13. size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
  14. void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size);
  15. =head1 DESCRIPTION
  16. The buffer library handles simple character arrays. Buffers are used for
  17. various purposes in the library, most notably memory BIOs.
  18. BUF_MEM_new() allocates a new buffer of zero size.
  19. BUF_MEM_new_ex() allocates a buffer with the specified flags.
  20. The flag B<BUF_MEM_FLAG_SECURE> specifies that the B<data> pointer
  21. should be allocated on the secure heap; see L<CRYPTO_secure_malloc(3)>.
  22. BUF_MEM_free() frees up an already existing buffer. The data is zeroed
  23. before freeing up in case the buffer contains sensitive data.
  24. BUF_MEM_grow() changes the size of an already existing buffer to
  25. B<len>. Any data already in the buffer is preserved if it increases in
  26. size.
  27. BUF_MEM_grow_clean() is similar to BUF_MEM_grow() but it sets any free'd
  28. or additionally-allocated memory to zero.
  29. BUF_reverse() reverses B<size> bytes at B<in> into B<out>. If B<in>
  30. is NULL, the array is reversed in-place.
  31. =head1 RETURN VALUES
  32. BUF_MEM_new() returns the buffer or NULL on error.
  33. BUF_MEM_free() has no return value.
  34. BUF_MEM_grow() and BUF_MEM_grow_clean() return
  35. zero on error or the new size (i.e., B<len>).
  36. =head1 SEE ALSO
  37. L<bio(7)>,
  38. L<CRYPTO_secure_malloc(3)>.
  39. =head1 HISTORY
  40. BUF_MEM_new_ex() was added in OpenSSL 1.1.0.
  41. =head1 COPYRIGHT
  42. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  43. Licensed under the OpenSSL license (the "License"). You may not use
  44. this file except in compliance with the License. You can obtain a copy
  45. in the file LICENSE in the source distribution or at
  46. L<https://www.openssl.org/source/license.html>.
  47. =cut