Implement S/G IO for batched sends and eliminate another frame copy (#2874)
This commit is contained in:
11
src/crypto.h
11
src/crypto.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user