2
0

EVP_chacha20.pod 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. =pod
  2. =head1 NAME
  3. EVP_chacha20,
  4. EVP_chacha20_poly1305
  5. - EVP ChaCha20 stream cipher
  6. =head1 SYNOPSIS
  7. #include <openssl/evp.h>
  8. const EVP_CIPHER *EVP_chacha20(void);
  9. const EVP_CIPHER *EVP_chacha20_poly1305(void);
  10. =head1 DESCRIPTION
  11. The ChaCha20 stream cipher for EVP.
  12. =over 4
  13. =item EVP_chacha20()
  14. The ChaCha20 stream cipher. The key length is 256 bits, the IV is 128 bits long.
  15. The first 64 bits consists of a counter in little-endian order followed by a 64
  16. bit nonce. For example a nonce of:
  17. 0000000000000002
  18. With an initial counter of 42 (2a in hex) would be expressed as:
  19. 2a000000000000000000000000000002
  20. =item EVP_chacha20_poly1305()
  21. Authenticated encryption with ChaCha20-Poly1305. Like EVP_chacha20(), the key
  22. is 256 bits and the IV is 96 bits. This supports additional authenticated data
  23. (AAD) and produces a 128-bit authentication tag. See the
  24. L<EVP_EncryptInit(3)/AEAD Interface> section for more information.
  25. =back
  26. =head1 NOTES
  27. Developers should be aware of the negative performance implications of
  28. calling these functions multiple times and should consider using
  29. L<EVP_CIPHER_fetch(3)> with L<EVP_CIPHER-CHACHA(7)> instead.
  30. See L<crypto(7)/Performance> for further information.
  31. L<RFC 7539|https://www.rfc-editor.org/rfc/rfc7539.html#section-2.4>
  32. uses a 32 bit counter and a 96 bit nonce for the IV.
  33. =head1 RETURN VALUES
  34. These functions return an B<EVP_CIPHER> structure that contains the
  35. implementation of the symmetric cipher. See L<EVP_CIPHER_meth_new(3)> for
  36. details of the B<EVP_CIPHER> structure.
  37. =head1 SEE ALSO
  38. L<evp(7)>,
  39. L<EVP_EncryptInit(3)>,
  40. L<EVP_CIPHER_meth_new(3)>
  41. =head1 COPYRIGHT
  42. Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
  43. Licensed under the Apache License 2.0 (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