20 #include <glog/logging.h> 21 #include <openssl/evp.h> 38 template <
typename EVPImpl>
40 static_assert(EVPImpl::kIVLength >=
sizeof(
uint64_t),
"iv too small");
52 return EVPImpl::kKeyLength;
56 return EVPImpl::kIVLength;
63 std::unique_ptr<folly::IOBuf>
encrypt(
64 std::unique_ptr<folly::IOBuf>&& plaintext,
69 std::unique_ptr<folly::IOBuf>&& ciphertext,
std::unique_ptr< folly::IOBuf > encrypt(std::unique_ptr< folly::IOBuf > &&plaintext, const folly::IOBuf *associatedData, uint64_t seqNum) const override
OpenSSLEVPCipher & operator=(OpenSSLEVPCipher &&other)=default
~OpenSSLEVPCipher() override=default
folly::ssl::EvpCipherCtxUniquePtr encryptCtx_
size_t ivLength() const override
folly::ssl::EvpCipherCtxUniquePtr decryptCtx_
std::array< uint8_t, EVPImpl::kIVLength > createIV(uint64_t seqNum) const
size_t keyLength() const override
folly::Optional< std::unique_ptr< folly::IOBuf > > tryDecrypt(std::unique_ptr< folly::IOBuf > &&ciphertext, const folly::IOBuf *associatedData, uint64_t seqNum) const override
std::unique_ptr< EVP_CIPHER_CTX, EvpCipherCtxDeleter > EvpCipherCtxUniquePtr
void setKey(TrafficKey trafficKey) override
void setEncryptedBufferHeadroom(size_t headroom) override
size_t getCipherOverhead() const override