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

Function encrypt_siv

libcppcryptfs/crypt/crypt.cpp:207–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207int encrypt_siv(const unsigned char *plaintext, int plaintext_len, unsigned char *aad,
208 int aad_len, const unsigned char *iv,
209 unsigned char *ciphertext, unsigned char *siv, const SivContext *context)
210{
211
212 if (aad_len != 24)
213 return -1;
214
215 unsigned char header_data[24+16];
216
217 memcpy(header_data, aad, aad_len);
218
219 memcpy(header_data + aad_len, iv, 16);
220
221 size_t header_sizes[2] = { 24, 16 };
222
223 memcpy(ciphertext, plaintext, plaintext_len);
224
225 if (!aes256_encrypt_siv(context, header_data, header_sizes, 2, ciphertext, plaintext_len, siv))
226 return -1;
227
228 return plaintext_len;
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,

Callers 1

write_blockFunction · 0.85

Calls 1

aes256_encrypt_sivFunction · 0.85

Tested by

no test coverage detected