diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-09-04 10:32:52 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-09-04 10:33:50 +0200 |
commit | 66b9a9409c73e298d6ceb668783a7cdd5ee85a69 (patch) | |
tree | be04b2c42d1b858756c5a8ba5355abd961589ec8 /sql/item_strfunc.cc | |
parent | d94a982adbc21d74c0202f1ef64119baeb27c597 (diff) | |
download | mariadb-git-66b9a9409c73e298d6ceb668783a7cdd5ee85a69.tar.gz |
New encryption API. Piece-wise encryption.
Instead of encrypt(src, dst, key, iv) that encrypts all
data in one go, now we have encrypt_init(key,iv),
encrypt_update(src,dst), and encrypt_finish(dst).
This also causes collateral changes in the internal my_crypt.cc
encryption functions and in the encryption service.
There are wrappers to provide the old all-at-once encryption
functionality. But binlog events are often written piecewise,
they'll need the new api.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7dfe8605b63..7f466e86afb 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -402,16 +402,16 @@ String *Item_aes_crypt::val_str(String *str) if (sptr && user_key) // we need both arguments to be not NULL { null_value=0; - aes_length=my_aes_get_size(sptr->length()); // Calculate result length + aes_length=my_aes_get_size(MY_AES_ECB, sptr->length()); if (!str_value.alloc(aes_length)) // Ensure that memory is free { uchar rkey[AES_KEY_LENGTH / 8]; create_key(user_key, rkey); - if (!crypt((uchar*)sptr->ptr(), sptr->length(), + if (!my_aes_crypt(MY_AES_ECB, what, (uchar*)sptr->ptr(), sptr->length(), (uchar*)str_value.ptr(), &aes_length, - rkey, AES_KEY_LENGTH / 8, 0, 0, 0)) + rkey, AES_KEY_LENGTH / 8, 0, 0)) { str_value.length((uint) aes_length); return &str_value; @@ -424,16 +424,16 @@ String *Item_aes_crypt::val_str(String *str) void Item_func_aes_encrypt::fix_length_and_dec() { - max_length=my_aes_get_size(args[0]->max_length); - crypt= my_aes_encrypt_ecb; + max_length=my_aes_get_size(MY_AES_ECB, args[0]->max_length); + what= ENCRYPTION_FLAG_ENCRYPT; } void Item_func_aes_decrypt::fix_length_and_dec() { - max_length=args[0]->max_length; - maybe_null= 1; - crypt= my_aes_decrypt_ecb; + max_length=args[0]->max_length; + maybe_null= 1; + what= ENCRYPTION_FLAG_DECRYPT; } |