20 memset(&
ctx, 0,
sizeof(
ctx));
35 memset(&
ctx, 0,
sizeof(
ctx));
54 if (!pad && padsize != 0)
63 enc.Encrypt(
out + written, mixed);
70 for (
int i = 0; i != padsize; i++)
74 enc.Encrypt(
out + written, mixed);
85 const unsigned char* prev = iv;
94 while (written != size) {
95 dec.Decrypt(
out,
data + written);
98 prev =
data + written;
106 unsigned char padsize = *--
out;
118 return written * !fail;
122 : enc(key), pad(padIn)
134 memset(
iv, 0,
sizeof(
iv));
138 : dec(key), pad(padIn)
151 memset(
iv, 0,
sizeof(
iv));
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)