38#include <openssl/evp.h>
44#define MY_AES_IV_SIZE 16
47#define MY_AES_BLOCK_SIZE 16
71#define MY_AES_BEGIN my_aes_128_ecb
72#define MY_AES_END my_aes_256_ofb
75#define MY_AES_BAD_DATA -1
99 unsigned char *dest,
const unsigned char *
key,
101 const unsigned char *iv,
bool padding =
true,
102 vector<string> *kdf_options =
nullptr);
125 uint32 source_length,
unsigned char *dest,
126 const unsigned char *
key,
uint32 key_length,
128 bool padding =
true, vector<string> *kdf_options =
nullptr);
146 unsigned char *dest,
const unsigned char *
key,
148 const unsigned char *iv,
bool padding =
true,
149 vector<string> *kdf_options =
nullptr);
170 uint32 source_length,
unsigned char *dest,
171 const unsigned char *
key,
uint32 key_length,
173 bool padding =
true, vector<string> *kdf_options =
nullptr);
bool my_aes_needs_iv(my_aes_opmode opmode)
Return true if the AES cipher and block mode requires an IV.
Definition: my_aes_openssl.cc:266
int my_aes_encrypt(const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, bool padding=true, vector< string > *kdf_options=nullptr)
Encrypt a buffer using AES.
Definition: my_aes_openssl.cc:148
my_aes_opmode
Supported AES cipher/block mode combos.
Definition: my_aes.h:50
@ my_aes_256_cbc
Definition: my_aes.h:56
@ my_aes_128_cbc
Definition: my_aes.h:54
@ my_aes_128_cfb128
Definition: my_aes.h:63
@ my_aes_128_ofb
Definition: my_aes.h:66
@ my_aes_256_cfb1
Definition: my_aes.h:59
@ my_aes_128_cfb1
Definition: my_aes.h:57
@ my_aes_192_cfb8
Definition: my_aes.h:61
@ my_aes_192_ofb
Definition: my_aes.h:67
@ my_aes_128_ecb
Definition: my_aes.h:51
@ my_aes_192_cfb1
Definition: my_aes.h:58
@ my_aes_256_ecb
Definition: my_aes.h:53
@ my_aes_192_ecb
Definition: my_aes.h:52
@ my_aes_128_cfb8
Definition: my_aes.h:60
@ my_aes_192_cfb128
Definition: my_aes.h:64
@ my_aes_256_cfb8
Definition: my_aes.h:62
@ my_aes_256_ofb
Definition: my_aes.h:68
@ my_aes_192_cbc
Definition: my_aes.h:55
@ my_aes_256_cfb128
Definition: my_aes.h:65
longlong my_aes_get_size(uint32 source_length, enum my_aes_opmode opmode)
Calculate the size of a buffer large enough for encrypted data.
Definition: my_aes_openssl.cc:255
const char * my_aes_opmode_names[]
String representations of the supported AES modes.
Definition: my_aes_openssl.cc:52
int my_aes_decrypt(const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, bool padding=true, vector< string > *kdf_options=nullptr)
Decrypt an AES encrypted buffer.
Definition: my_aes_openssl.cc:200
Some integer typedefs for easier portability.
long long int longlong
Definition: my_inttypes.h:55
uint32_t uint32
Definition: my_inttypes.h:67
mode
Definition: file_handle.h:61
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
required string key
Definition: replication_asynchronous_connection_failover.proto:60
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42