This is on the OpenSSL compatibility list.
See https://www.rfc-editor.org/info/rfc8439/ - there's actually a couple of ways to implement ChaCha20 but this is the one that's required (the nonce/counter split is different from the original specification, so be sure to follow the RFC).
OpenSSL implement ChaCha20-Poly1305 as an AEAD cipher and implement Poly1305 separately as a MAC and ChaCha20 separately as a stream cipher. We should probably follow the pattern.
Note: there are also Wycheproof test vectors for this one, in addition to what's in the RFC. Both Bouncy Castle and OpenSSL can also be used to test against.
This is on the OpenSSL compatibility list.
See https://www.rfc-editor.org/info/rfc8439/ - there's actually a couple of ways to implement ChaCha20 but this is the one that's required (the nonce/counter split is different from the original specification, so be sure to follow the RFC).
OpenSSL implement ChaCha20-Poly1305 as an AEAD cipher and implement Poly1305 separately as a MAC and ChaCha20 separately as a stream cipher. We should probably follow the pattern.
Note: there are also Wycheproof test vectors for this one, in addition to what's in the RFC. Both Bouncy Castle and OpenSSL can also be used to test against.