Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
1eda3d64
Commit
1eda3d64
authored
Jan 12, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify ASHE layer again, the initial version that can create table
parent
559f8a45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
12 deletions
+24
-12
.CURRENT.conf.swp
conf/.CURRENT.conf.swp
+0
-0
CryptoHandlers.cc
main/CryptoHandlers.cc
+19
-11
CryptoHandlers.hh
main/CryptoHandlers.hh
+5
-1
No files found.
conf/.CURRENT.conf.swp
0 → 100644
View file @
1eda3d64
File added
main/CryptoHandlers.cc
View file @
1eda3d64
...
@@ -1814,34 +1814,42 @@ const std::vector<udf_func*> udf_list = {
...
@@ -1814,34 +1814,42 @@ const std::vector<udf_func*> udf_list = {
/************************************************ASHE********************************************/
/************************************************ASHE********************************************/
ASHE
::
ASHE
(
const
Create_field
&
f
,
const
std
::
string
&
seed_key
)
ASHE
::
ASHE
(
unsigned
int
id
,
const
std
::
string
&
serial
)
:
ashe
(
1
){}
:
seed_key
(
seed_key
)
{}
ASHE
::
ASHE
(
unsigned
int
id
,
const
std
::
string
&
serial
){}
/*the type of filed after the ASHE layer is used.*/
Create_field
*
Create_field
*
ASHE
::
newCreateField
(
const
Create_field
&
cf
,
ASHE
::
newCreateField
(
const
Create_field
&
cf
,
const
std
::
string
&
anonname
)
const
{
const
std
::
string
&
anonname
)
const
{
return
NULL
;
const
THD
*
const
thd
=
current_thd
;
Create_field
*
const
f0
=
cf
.
clone
(
thd
->
mem_root
);
// if (charset != NULL) {
// f0->charset = charset;
// }
if
(
anonname
.
size
()
>
0
)
{
f0
->
field_name
=
make_thd_string
(
anonname
);
}
return
f0
;
}
}
//if first, use seed key to generate
//if first, use seed key to generate
Item
*
Item
*
ASHE
::
encrypt
(
const
Item
&
ptext
,
uint64_t
IV
)
const
{
ASHE
::
encrypt
(
const
Item
&
ptext
,
uint64_t
IV
)
const
{
return
NULL
;
ulonglong
pt
=
const_cast
<
Item
&>
(
ptext
).
val_uint
();
return
new
(
current_thd
->
mem_root
)
Item_int
(
static_cast
<
ulonglong
>
(
pt
));
}
}
Item
*
Item
*
ASHE
::
decrypt
(
const
Item
&
ctext
,
uint64_t
IV
)
const
ASHE
::
decrypt
(
const
Item
&
ctext
,
uint64_t
IV
)
const
{
{
return
NULL
;
long
long
ct
=
const_cast
<
Item
&>
(
ctext
).
val_uint
();
return
new
(
current_thd
->
mem_root
)
Item_int
(
static_cast
<
ulonglong
>
(
ct
));
}
}
ASHE
::~
ASHE
()
{
ASHE
::~
ASHE
()
{
}
}
main/CryptoHandlers.hh
View file @
1eda3d64
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <crypto/blowfish.hh>
#include <crypto/blowfish.hh>
#include <parser/sql_utils.hh>
#include <parser/sql_utils.hh>
#include <crypto/SWPSearch.hh>
#include <crypto/SWPSearch.hh>
#include "crypto/ASHE.hh"
#include <main/dbobject.hh>
#include <main/dbobject.hh>
#include <main/macro_util.hh>
#include <main/macro_util.hh>
...
@@ -119,7 +120,9 @@ private:
...
@@ -119,7 +120,9 @@ private:
class
ASHE
:
public
EncLayer
{
class
ASHE
:
public
EncLayer
{
public
:
public
:
ASHE
(
const
Create_field
&
cf
,
const
std
::
string
&
seed_key
);
ASHE
(
const
Create_field
&
cf
,
const
std
::
string
&
seed_key
)
:
seed_key
(
seed_key
),
ashe
(
1
){
}
// serialize and deserialize
// serialize and deserialize
std
::
string
doSerialize
()
const
{
return
seed_key
;}
std
::
string
doSerialize
()
const
{
return
seed_key
;}
...
@@ -136,6 +139,7 @@ public:
...
@@ -136,6 +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
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment