MySQL 8.0.39
Source Code Documentation
|
#include <assert.h>
#include <openssl/aes.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include "m_string.h"
#include "my_aes.h"
#include "my_aes_impl.h"
#include "mysys/my_kdf.h"
Functions | |
int | dummy_function_needed_by_xplugin () |
static const EVP_CIPHER * | aes_evp_type (const my_aes_opmode mode) |
int | my_create_key (unsigned char *rkey, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, vector< string > *kdf_options) |
Creates required length of AES key, Input key size can be smaller or bigger in length, we need exact AES key size. More... | |
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, vector< string > *kdf_options) |
Encrypt a buffer using AES. More... | |
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, vector< string > *kdf_options) |
Decrypt an AES encrypted buffer. More... | |
longlong | my_aes_get_size (uint32 source_length, my_aes_opmode opmode) |
Calculate the size of a buffer large enough for encrypted data. More... | |
bool | my_aes_needs_iv (my_aes_opmode opmode) |
Return true if the AES cipher and block mode requires an IV. More... | |
Variables | |
const char * | my_aes_opmode_names [] |
String representations of the supported AES modes. More... | |
static uint | my_aes_opmode_key_sizes_impl [] |
uint * | my_aes_opmode_key_sizes = my_aes_opmode_key_sizes_impl |
|
static |
int dummy_function_needed_by_xplugin | ( | ) |
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.
source | Pointer to data for decryption |
source_length | size of encrypted data |
dest | buffer to place decrypted data (must be large enough) |
key | Key to be used for decryption |
key_length | Length of the key. Will handle keys of any length |
mode | encryption mode |
iv | 16 bytes initialization vector if needed. Otherwise NULL |
padding | if padding needed. |
kdf_options | KDF options |
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.
[in] | source | Pointer to data for encryption |
[in] | source_length | Size of encryption data |
[out] | dest | Buffer to place encrypted data (must be large enough and not overlap with source) |
[in] | key | Key to be used for encryption |
[in] | key_length | Length of the key. Will handle keys of any length |
[in] | mode | encryption mode |
[in] | iv | 16 bytes initialization vector if needed. Otherwise NULL |
[in] | padding | if padding needed. |
kdf_options | KDF options |
longlong my_aes_get_size | ( | uint32 | source_length, |
enum my_aes_opmode | opmode | ||
) |
Calculate the size of a buffer large enough for encrypted data.
source_length | length of data to be encrypted |
opmode | encryption mode |
bool my_aes_needs_iv | ( | my_aes_opmode | opmode | ) |
Return true if the AES cipher and block mode requires an IV.
opmode | encryption mode |
true | IV needed |
false | IV not needed |
int my_create_key | ( | unsigned char * | rkey, |
const unsigned char * | key, | ||
uint32 | key_length, | ||
enum my_aes_opmode | mode, | ||
vector< string > * | kdf_options | ||
) |
Creates required length of AES key, Input key size can be smaller or bigger in length, we need exact AES key size.
If KDF options are valid and given, use KDF functionality. otherwise use previously used method.
[out] | rkey | Output key |
key | Input key | |
key_length | input key length | |
mode | AES mode | |
kdf_options | KDF function options |
uint* my_aes_opmode_key_sizes = my_aes_opmode_key_sizes_impl |
|
static |
const char* my_aes_opmode_names[] |
String representations of the supported AES modes.
Keep in sync with my_aes_opmode