EVP_CIPHER_CTX_get_original_iv.pod 2.9 KB

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