Chacha20Poly1305 decryption with tag verification. RFC 7539.
120 {
123
124 unsigned long long int res_len = plaintext_len ? *plaintext_len : length;
125 auto r = crypto_aead_chacha20poly1305_ietf_decrypt(
126 reinterpret_cast<unsigned char *>(plaintext), &res_len, nullptr,
127 static_cast<const unsigned char *
>(ciphertext), length,
nullptr, 0, iv,
key);
128
129 if (r != 0){
131 }
132
133 if (plaintext_len){
134 *plaintext_len = (size_t) res_len;
135 }
136 }
#define CHECK_AND_ASSERT_THROW_MES(expr, message)