xref: /freebsd/crypto/openssl/doc/man3/EVP_chacha20.pod (revision ad991e4c142ebabad7aef488ad97b189ecabb270)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimEVP_chacha20,
6e71b7053SJung-uk KimEVP_chacha20_poly1305
7e71b7053SJung-uk Kim- EVP ChaCha20 stream cipher
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim=head1 SYNOPSIS
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim #include <openssl/evp.h>
12e71b7053SJung-uk Kim
13b077aed3SPierre Pronchery const EVP_CIPHER *EVP_chacha20(void);
14b077aed3SPierre Pronchery const EVP_CIPHER *EVP_chacha20_poly1305(void);
15e71b7053SJung-uk Kim
16e71b7053SJung-uk Kim=head1 DESCRIPTION
17e71b7053SJung-uk Kim
18e71b7053SJung-uk KimThe ChaCha20 stream cipher for EVP.
19e71b7053SJung-uk Kim
20e71b7053SJung-uk Kim=over 4
21e71b7053SJung-uk Kim
22e71b7053SJung-uk Kim=item EVP_chacha20()
23e71b7053SJung-uk Kim
24610a21fdSJung-uk KimThe ChaCha20 stream cipher. The key length is 256 bits, the IV is 128 bits long.
25aa795734SPierre ProncheryThe first 64 bits consists of a counter in little-endian order followed by a 64
26610a21fdSJung-uk Kimbit nonce. For example a nonce of:
27610a21fdSJung-uk Kim
28aa795734SPierre Pronchery0000000000000002
29610a21fdSJung-uk Kim
30610a21fdSJung-uk KimWith an initial counter of 42 (2a in hex) would be expressed as:
31610a21fdSJung-uk Kim
32610a21fdSJung-uk Kim2a000000000000000000000000000002
33e71b7053SJung-uk Kim
34e71b7053SJung-uk Kim=item EVP_chacha20_poly1305()
35e71b7053SJung-uk Kim
36e71b7053SJung-uk KimAuthenticated encryption with ChaCha20-Poly1305. Like EVP_chacha20(), the key
37e71b7053SJung-uk Kimis 256 bits and the IV is 96 bits. This supports additional authenticated data
38e71b7053SJung-uk Kim(AAD) and produces a 128-bit authentication tag. See the
39e71b7053SJung-uk KimL<EVP_EncryptInit(3)/AEAD Interface> section for more information.
40e71b7053SJung-uk Kim
41e71b7053SJung-uk Kim=back
42e71b7053SJung-uk Kim
43b077aed3SPierre Pronchery=head1 NOTES
44b077aed3SPierre Pronchery
45b077aed3SPierre ProncheryDevelopers should be aware of the negative performance implications of
46b077aed3SPierre Proncherycalling these functions multiple times and should consider using
47*ad991e4cSEd MasteL<EVP_CIPHER_fetch(3)> with L<EVP_CIPHER-CHACHA(7)> instead.
48b077aed3SPierre ProncherySee L<crypto(7)/Performance> for further information.
49b077aed3SPierre Pronchery
50aa795734SPierre ProncheryL<RFC 7539|https://www.rfc-editor.org/rfc/rfc7539.html#section-2.4>
51aa795734SPierre Proncheryuses a 32 bit counter and a 96 bit nonce for the IV.
52aa795734SPierre Pronchery
53e71b7053SJung-uk Kim=head1 RETURN VALUES
54e71b7053SJung-uk Kim
55e71b7053SJung-uk KimThese functions return an B<EVP_CIPHER> structure that contains the
56e71b7053SJung-uk Kimimplementation of the symmetric cipher. See L<EVP_CIPHER_meth_new(3)> for
57e71b7053SJung-uk Kimdetails of the B<EVP_CIPHER> structure.
58e71b7053SJung-uk Kim
59e71b7053SJung-uk Kim=head1 SEE ALSO
60e71b7053SJung-uk Kim
61e71b7053SJung-uk KimL<evp(7)>,
62e71b7053SJung-uk KimL<EVP_EncryptInit(3)>,
63e71b7053SJung-uk KimL<EVP_CIPHER_meth_new(3)>
64e71b7053SJung-uk Kim
65e71b7053SJung-uk Kim=head1 COPYRIGHT
66e71b7053SJung-uk Kim
67b077aed3SPierre ProncheryCopyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
68e71b7053SJung-uk Kim
69b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
70e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
71e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
72e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
73e71b7053SJung-uk Kim
74e71b7053SJung-uk Kim=cut
75e71b7053SJung-uk Kim
76