Commit 5a424dff authored by yiwenshao's avatar yiwenshao

need to debug the ASHE_RAW algorithm, the overall process is finished

parent 0822f1ea
...@@ -1825,7 +1825,8 @@ ASHE::newCreateField(const Create_field &cf, ...@@ -1825,7 +1825,8 @@ ASHE::newCreateField(const Create_field &cf,
// if (charset != NULL) { // if (charset != NULL) {
// f0->charset = charset; // f0->charset = charset;
// } // }
f0->flags = f0->flags ^ UNSIGNED_FLAG;
f0->sql_type = MYSQL_TYPE_LONGLONG;
if (anonname.size() > 0) { if (anonname.size() > 0) {
f0->field_name = make_thd_string(anonname); f0->field_name = make_thd_string(anonname);
} }
...@@ -1836,17 +1837,18 @@ ASHE::newCreateField(const Create_field &cf, ...@@ -1836,17 +1837,18 @@ ASHE::newCreateField(const Create_field &cf,
Item * Item *
ASHE::encrypt(const Item &ptext, uint64_t IV) const{ ASHE::encrypt(const Item &ptext, uint64_t IV) const{
ulonglong pt = const_cast<Item &>(ptext).val_uint(); ulonglong pt = const_cast<Item &>(ptext).val_uint();
auto res = ashe.encrypt(pt,IV);
return new (current_thd->mem_root) return new (current_thd->mem_root)
Item_int(static_cast<ulonglong>(pt)); Item_int(static_cast<longlong>(res.first));
} }
Item * Item *
ASHE::decrypt(const Item &ctext, uint64_t IV) const ASHE::decrypt(const Item &ctext, uint64_t IV) const
{ {
long long ct = const_cast<Item &>(ctext).val_uint(); long long ct = const_cast<Item &>(ctext).val_uint();
auto res = ashe.decrypt(ct,IV);
return new (current_thd->mem_root) return new (current_thd->mem_root)
Item_int(static_cast<ulonglong>(ct)); Item_int(static_cast<ulonglong>(res));
} }
ASHE::~ASHE() { ASHE::~ASHE() {
......
...@@ -139,7 +139,7 @@ public: ...@@ -139,7 +139,7 @@ public:
Item * decrypt(const Item &c, uint64_t IV) const; Item * decrypt(const Item &c, uint64_t IV) const;
protected: protected:
std::string const seed_key; std::string const seed_key;
const RAW_ASHE ashe; mutable RAW_ASHE ashe;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment