57 if (!pad && padsize != 0)
66 enc.Encrypt(
out + written, mixed);
73 for (
int i = 0; i != padsize; i++)
77 enc.Encrypt(
out + written, mixed);
88 const unsigned char* prev = iv;
97 while (written != size) {
98 dec.Decrypt(
out,
data + written);
101 prev =
data + written;
109 unsigned char padsize = *--
out;
121 return written * !fail;
125 : enc(key), pad(padIn)
142 : 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
secure_allocator< unsigned char > allocator
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
secure_allocator< unsigned char > allocator
secure_allocator< AES256_ctx > allocator
AES256Decrypt(const unsigned char key[32])
void Decrypt(unsigned char plaintext[16], const unsigned char ciphertext[16]) const
secure_allocator< AES256_ctx > allocator
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)
T * allocate(std::size_t n)
void deallocate(T *p, std::size_t n)