1 =pod 2 3 =head1 NAME 4 5 EVP_chacha20, 6 EVP_chacha20_poly1305 7 - EVP ChaCha20 stream cipher 8 9 =head1 SYNOPSIS 10 11 #include <openssl/evp.h> 12 13 const EVP_CIPHER *EVP_chacha20(void); 14 const EVP_CIPHER *EVP_chacha20_poly1305(void); 15 16 =head1 DESCRIPTION 17 18 The ChaCha20 stream cipher for EVP. 19 20 =over 4 21 22 =item EVP_chacha20() 23 24 The ChaCha20 stream cipher. The key length is 256 bits, the IV is 128 bits long. 25 The first 64 bits consists of a counter in little-endian order followed by a 64 26 bit nonce. For example a nonce of: 27 28 0000000000000002 29 30 With an initial counter of 42 (2a in hex) would be expressed as: 31 32 2a000000000000000000000000000002 33 34 =item EVP_chacha20_poly1305() 35 36 Authenticated encryption with ChaCha20-Poly1305. Like EVP_chacha20(), the key 37 is 256 bits and the IV is 96 bits. This supports additional authenticated data 38 (AAD) and produces a 128-bit authentication tag. See the 39 L<EVP_EncryptInit(3)/AEAD Interface> section for more information. 40 41 =back 42 43 =head1 NOTES 44 45 Developers should be aware of the negative performance implications of 46 calling these functions multiple times and should consider using 47 L<EVP_CIPHER_fetch(3)> with L<EVP_CIPHER-CHACHA(7)> instead. 48 See L<crypto(7)/Performance> for further information. 49 50 L<RFC 7539|https://www.rfc-editor.org/rfc/rfc7539.html#section-2.4> 51 uses a 32 bit counter and a 96 bit nonce for the IV. 52 53 =head1 RETURN VALUES 54 55 These functions return an B<EVP_CIPHER> structure that contains the 56 implementation of the symmetric cipher. See L<EVP_CIPHER_meth_new(3)> for 57 details of the B<EVP_CIPHER> structure. 58 59 =head1 SEE ALSO 60 61 L<evp(7)>, 62 L<EVP_EncryptInit(3)>, 63 L<EVP_CIPHER_meth_new(3)> 64 65 =head1 COPYRIGHT 66 67 Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. 68 69 Licensed under the Apache License 2.0 (the "License"). You may not use 70 this file except in compliance with the License. You can obtain a copy 71 in the file LICENSE in the source distribution or at 72 L<https://www.openssl.org/source/license.html>. 73 74 =cut 75 76