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
d595569b
Commit
d595569b
authored
Mar 01, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sumUDA to ASHE in CryptoHandler.cc
parent
793fa1ca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
17 deletions
+50
-17
CryptoHandlers.cc
main/CryptoHandlers.cc
+27
-14
CryptoHandlers.hh
main/CryptoHandlers.hh
+2
-0
dml_handler.cc
main/dml_handler.cc
+4
-3
.Makefrag.swp
parser/.Makefrag.swp
+0
-0
showselect_lex.cc
test_parser_helper/showselect_lex.cc
+17
-0
No files found.
main/CryptoHandlers.cc
View file @
d595569b
...
...
@@ -1334,20 +1334,6 @@ static udf_func u_sum_a = {
NULL
,
0L
,
};
static
udf_func
u_sumashe_a
=
{
LEXSTRING
(
"cryptdb_asheagg"
),
STRING_RESULT
,
UDFTYPE_AGGREGATE
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0L
,
};
static
udf_func
u_sum_f
=
{
LEXSTRING
(
"cryptdb_func_add_set"
),
...
...
@@ -1610,6 +1596,21 @@ static udf_func u_cryptdb_version = {
0L
,
};
static
udf_func
u_sumashe_a
=
{
LEXSTRING
(
"cryptdb_asheagg"
),
STRING_RESULT
,
UDFTYPE_AGGREGATE
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0L
,
};
const
std
::
vector
<
udf_func
*>
udf_list
=
{
&
u_decRNDInt
,
&
u_decRNDString
,
...
...
@@ -1625,6 +1626,8 @@ const std::vector<udf_func*> udf_list = {
/************************************************ASHE********************************************/
ASHE
::
ASHE
(
unsigned
int
id
,
const
std
::
string
&
serial
)
:
ashe
(
1
){}
/*the type of filed after the ASHE layer is used.*/
...
...
@@ -1662,6 +1665,16 @@ ASHE::decrypt(const Item &ctext, uint64_t IV) const
Item_int
(
static_cast
<
ulonglong
>
(
res
));
}
Item
*
ASHE
::
sumUDA
(
Item
*
const
expr
)
const
{
List
<
Item
>
l
;
l
.
push_back
(
expr
);
// l.push_back(ZZToItemStr(sk->hompubkey()));
return
new
(
current_thd
->
mem_root
)
Item_func_udf_str
(
&
u_sumashe_a
,
l
);
}
ASHE
::~
ASHE
()
{
}
...
...
main/CryptoHandlers.hh
View file @
d595569b
...
...
@@ -199,6 +199,8 @@ public:
//TODO needs multi encrypt and decrypt
Item
*
encrypt
(
const
Item
&
p
,
uint64_t
IV
)
const
;
Item
*
decrypt
(
const
Item
&
c
,
uint64_t
IV
)
const
;
Item
*
sumUDA
(
Item
*
const
expr
)
const
;
protected
:
std
::
string
const
seed_key
;
mutable
RAW_ASHE
ashe
;
...
...
main/dml_handler.cc
View file @
d595569b
...
...
@@ -647,7 +647,7 @@ addSaltToReturn(ReturnMeta *const rm, int pos)
rm
->
rfmeta
.
insert
(
pair
);
}
//Item
是当前需要加密的item, rp是gather阶段存入的RewritePlain,加密的结果放在newList中, Analysis用于辅助分析
.
//Item
needs to be encrypted using the RewritePlain from the gather phase. The results will be put in newList, and Analysis is helper class
.
static
void
rewrite_proj
(
const
Item
&
i
,
const
RewritePlan
&
rp
,
Analysis
&
a
,
List
<
Item
>
*
const
newList
)
{
...
...
@@ -661,7 +661,7 @@ rewrite_proj(const Item &i, const RewritePlan &rp, Analysis &a,
ir
=
cached_rewritten_i
->
second
.
first
;
olk
=
cached_rewritten_i
->
second
.
second
;
}
else
{
//
对于select中的选择域来说,这里对应的是rewrite_field.cc中的83, do_rewrite_type
//
rewrite=>do_rewrite_type for Item of type FIELD_ITEM
ir
=
rewrite
(
i
,
rp
.
es_out
,
a
);
olk
=
rp
.
es_out
.
chooseOne
();
}
...
...
@@ -669,7 +669,8 @@ rewrite_proj(const Item &i, const RewritePlan &rp, Analysis &a,
ir
=
rewrite
(
i
,
rp
.
es_out
,
a
);
olk
=
rp
.
es_out
.
chooseOne
();
}
//和insert不同, select的时候, 只要一个洋葱, 选取一个进行改写就可以了, 不需要扩展.
//Different form INSERT, SELECT needs only one onion.
assert
(
ir
.
assigned
()
&&
ir
.
get
());
newList
->
push_back
(
ir
.
get
());
const
bool
use_salt
=
needsSalt
(
olk
.
get
());
...
...
parser/.Makefrag.swp
deleted
100644 → 0
View file @
793fa1ca
File deleted
test_parser_helper/showselect_lex.cc
View file @
d595569b
...
...
@@ -2,6 +2,13 @@
#include "test_parser_helper/showselect_lex.hh"
#include "test_parser_helper/showparser.hh"
#include "test_parser_helper/showitem.hh"
static
void
show_order
(
const
SQL_I_List
<
ORDER
>
&
lst
)
{
for
(
const
ORDER
*
o
=
lst
.
first
;
o
;
o
=
o
->
next
)
{
}
}
static
void
show_table_joins_and_derived
(
const
List
<
TABLE_LIST
>
&
tll
)
{
List_iterator
<
TABLE_LIST
>
join_it
=
...
...
@@ -63,5 +70,15 @@ show_select_lex(const st_select_lex &select_lex) {
std
::
cout
<<
SHOW
::
ITEM
::
trans
[
item
->
type
()]
<<
std
::
endl
;
show_item
(
item
);
}
//fielter
if
(
select_lex
.
where
)
{
}
if
(
select_lex
.
having
)
{
}
show_order
(
select_lex
.
group_list
);
show_order
(
select_lex
.
order_list
);
}
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