MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / decrypt_siv

Function decrypt_siv

libcppcryptfs/crypt/crypt.cpp:231–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231int decrypt_siv(const unsigned char *ciphertext, int ciphertext_len, unsigned char *aad,
232 int aad_len, const unsigned char *siv, const unsigned char *iv,
233 unsigned char *plaintext, const SivContext *context)
234{
235
236 if (aad_len != 24)
237 return -1;
238
239 unsigned char header_data[24+16];
240
241 memcpy(header_data, aad, aad_len);
242
243 memcpy(header_data + aad_len, iv, 16);
244
245 size_t header_sizes[2] = { 24, 16 };
246
247 memcpy(plaintext, ciphertext, ciphertext_len);
248
249 if (!aes256_decrypt_siv(context, header_data, header_sizes, 2, plaintext, ciphertext_len, siv))
250 return -1;
251
252 return ciphertext_len;
253}
254
255
256bool sha256(const BYTE *data, int datalen, BYTE *sum)

Callers 1

read_blockFunction · 0.85

Calls 1

aes256_decrypt_sivFunction · 0.85

Tested by

no test coverage detected