MCPcopy Create free account
hub / github.com/apple/foundationdb / decrypt

Method decrypt

flow/StreamCipher.cpp:155–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155StringRef DecryptionStreamCipher::decrypt(unsigned char const* ciphertext, int len, Arena& arena) {
156 CODE_PROBE(true, "Decrypting data with StreamCipher");
157 auto plaintext = new (arena) unsigned char[len];
158 int bytesDecrypted{ 0 };
159 EVP_DecryptUpdate(cipher.getCtx(), plaintext, &bytesDecrypted, ciphertext, len);
160 int finalBlockBytes{ 0 };
161 EVP_DecryptFinal_ex(cipher.getCtx(), plaintext + bytesDecrypted, &finalBlockBytes);
162 return StringRef(plaintext, bytesDecrypted + finalBlockBytes);
163}
164
165StringRef DecryptionStreamCipher::finish(Arena& arena) {
166 auto plaintext = new (arena) unsigned char[AES_BLOCK_SIZE];

Callers 1

StreamCipher.cppFile · 0.45

Calls 2

StringRefClass · 0.50
getCtxMethod · 0.45

Tested by

no test coverage detected