Implement S/G IO for batched sends and eliminate another frame copy (#2874)

This commit is contained in:
Cameron Gutman
2024-07-18 23:04:18 -05:00
committed by GitHub
parent 16f62436a9
commit 3935d305ae
6 changed files with 199 additions and 56 deletions

View File

@@ -125,6 +125,17 @@ namespace crypto {
gcm_t(const crypto::aes_t &key, bool padding = true);
/**
* @brief Encrypts the plaintext using AES GCM mode.
* @param plaintext The plaintext data to be encrypted.
* @param tag The buffer where the GCM tag will be written.
* @param ciphertext The buffer where the resulting ciphertext will be written.
* @param iv The initialization vector to be used for the encryption.
* @return The total length of the ciphertext and GCM tag. Returns -1 in case of an error.
*/
int
encrypt(const std::string_view &plaintext, std::uint8_t *tag, std::uint8_t *ciphertext, aes_t *iv);
/**
* @brief Encrypts the plaintext using AES GCM mode.
* length of cipher must be at least: round_to_pkcs7_padded(plaintext.size()) + crypto::cipher::tag_size