summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index b79009c6778..ca1f3966da2 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -3,7 +3,7 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013, Monty Program Ab.
+ Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -134,21 +134,35 @@ public:
const char *func_name() const { return "from_base64"; }
};
+#include <my_crypt.h>
-class Item_func_aes_encrypt :public Item_str_func
+class Item_aes_crypt :public Item_str_func
{
+ enum { AES_KEY_LENGTH = 128 };
+ void create_key(String *user_key, uchar* key);
+
+protected:
+ int (*crypt)(const uchar* src, uint slen, uchar* dst, uint* dlen,
+ const uchar* key, uint klen, const uchar* iv, uint ivlen,
+ int no_padding);
+
public:
- Item_func_aes_encrypt(Item *a, Item *b) :Item_str_func(a,b) {}
+ Item_aes_crypt(Item *a, Item *b) :Item_str_func(a,b) {}
String *val_str(String *);
+};
+
+class Item_func_aes_encrypt :public Item_aes_crypt
+{
+public:
+ Item_func_aes_encrypt(Item *a, Item *b) :Item_aes_crypt(a,b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_encrypt"; }
};
-class Item_func_aes_decrypt :public Item_str_func
+class Item_func_aes_decrypt :public Item_aes_crypt
{
public:
- Item_func_aes_decrypt(Item *a, Item *b) :Item_str_func(a,b) {}
- String *val_str(String *);
+ Item_func_aes_decrypt(Item *a, Item *b) :Item_aes_crypt(a,b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_decrypt"; }
};
@@ -929,7 +943,6 @@ public:
Item_func_conv_charset(Item *a, CHARSET_INFO *cs, bool cache_if_const)
:Item_str_func(a)
{
- DBUG_ASSERT(args[0]->fixed);
conv_charset= cs;
if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive())
{