EVP_CIPHER_CTX_get_iv.pod 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. =pod
  2. =head1 NAME
  3. EVP_CIPHER_CTX_get_iv, EVP_CIPHER_CTX_get_iv_state, EVP_CIPHER_CTX_iv, EVP_CIPHER_CTX_original_iv, EVP_CIPHER_CTX_iv_noconst - Routines to inspect EVP_CIPHER_CTX IV data
  4. =head1 SYNOPSIS
  5. #include <openssl/evp.h>
  6. int EVP_CIPHER_CTX_get_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
  7. int EVP_CIPHER_CTX_get_iv_state(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
  8. const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);
  9. const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);
  10. unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);
  11. =head1 DESCRIPTION
  12. EVP_CIPHER_CTX_get_iv() and EVP_CIPHER_CTX_get_iv_state() copy initialization
  13. vector (IV) information from the B<EVP_CIPHER_CTX> into the caller-supplied
  14. buffer. L<EVP_CIPHER_CTX_iv_length(3)> can be used to determine an
  15. appropriate buffer size, and if the supplied buffer is too small, an error
  16. will be returned (and no data copied). EVP_CIPHER_CTX_get_iv() accesses the
  17. ("original") IV that was supplied when the B<EVP_CIPHER_CTX> was created, and
  18. EVP_CIPHER_CTX_get_iv_state() accesses the current "IV state" of the cipher,
  19. which is updated during cipher operation for certain cipher modes (e.g., CBC
  20. and OFB).
  21. The functions EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and
  22. EVP_CIPHER_CTX_iv_noconst() are deprecated functions that provide similar (at
  23. a conceptual level) functionality. EVP_CIPHER_CTX_iv() returns a pointer to
  24. the beginning of the "IV state" as maintained internally in the
  25. B<EVP_CIPHER_CTX>; EVP_CIPHER_CTX_original_iv() returns a pointer to the
  26. beginning of the ("original") IV, as maintained by the B<EVP_CIPHER_CTX>, that
  27. was provided when the B<EVP_CIPHER_CTX> was initialized; and
  28. EVP_CIPHER_CTX_get_iv_noconst() is the same as EVP_CIPHER_CTX_iv() but has a
  29. different return type for the pointer.
  30. =head1 RETURN VALUES
  31. EVP_CIPHER_CTX_get_iv() and EVP_CIPHER_CTX_get_iv_state() return 1 on success
  32. and 0 on failure.
  33. The functions EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and
  34. EVP_CIPHER_CTX_iv_noconst() return a pointer to an IV as an array of bytes on
  35. success, and NULL on failure.
  36. =head1 HISTORY
  37. EVP_CIPHER_CTX_get_iv() and EVP_CIPHER_CTX_get_iv_state() were added in
  38. OpenSSL 3.0.0.
  39. EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and
  40. EVP_CIPHER_CTX_iv_noconst() were added in OpenSSL 1.1.0, and were deprecated
  41. in OpenSSL 3.0.0.
  42. =head1 COPYRIGHT
  43. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  44. Licensed under the Apache License 2.0 (the "License"). You may not use
  45. this file except in compliance with the License. You can obtain a copy
  46. in the file LICENSE in the source distribution or at
  47. L<https://www.openssl.org/source/license.html>.
  48. =cut