45static int CBCEncrypt(
const T& enc,
const unsigned char iv[
AES_BLOCKSIZE],
const unsigned char* data,
int size,
bool pad,
unsigned char* out)
51 if (!data || !size || !out)
70 for (
int i = 0; i !=
padsize; i++)
81static int CBCDecrypt(
const T& dec,
const unsigned char iv[
AES_BLOCKSIZE],
const unsigned char* data,
int size,
bool pad,
unsigned char* out)
85 const unsigned char*
prev = iv;
87 if (!data || !size || !out)
95 dec.Decrypt(out, data +
written);
106 unsigned char padsize = *--out;
122 : enc(key), pad(
padIn)
138 : dec(key), pad(
padIn)
static int CBCEncrypt(const T &enc, const unsigned char iv[AES_BLOCKSIZE], const unsigned char *data, int size, bool pad, unsigned char *out)
static int CBCDecrypt(const T &dec, const unsigned char iv[AES_BLOCKSIZE], const unsigned char *data, int size, bool pad, unsigned char *out)
static const int AES256_KEYSIZE
static const int AES_BLOCKSIZE
AES256CBCDecrypt(const unsigned char key[AES256_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn)
int Decrypt(const unsigned char *data, int size, unsigned char *out) const
unsigned char iv[AES_BLOCKSIZE]
AES256CBCEncrypt(const unsigned char key[AES256_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn)
int Encrypt(const unsigned char *data, int size, unsigned char *out) const
unsigned char iv[AES_BLOCKSIZE]
AES256Decrypt(const unsigned char key[32])
void Decrypt(unsigned char plaintext[16], const unsigned char ciphertext[16]) const
AES256Encrypt(const unsigned char key[32])
void Encrypt(unsigned char ciphertext[16], const unsigned char plaintext[16]) const
void AES256_encrypt(const AES256_ctx *ctx, size_t blocks, unsigned char *cipher16, const unsigned char *plain16)
void AES256_init(AES256_ctx *ctx, const unsigned char *key32)
void AES256_decrypt(const AES256_ctx *ctx, size_t blocks, unsigned char *plain16, const unsigned char *cipher16)
#define T(expected, seed, data)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.