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
3e37e752
Commit
3e37e752
authored
Jan 26, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to configure decryption onion and select choosen onions
parent
beec50da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
7 deletions
+74
-7
final_load.cc
debug/final_load.cc
+25
-1
constants.cc
util/constants.cc
+34
-4
constants.hh
util/constants.hh
+5
-0
reuse.cc
wrapper/reuse.cc
+10
-2
No files found.
debug/final_load.cc
View file @
3e37e752
...
@@ -93,6 +93,8 @@ std::shared_ptr<ReturnMeta> getReturnMeta(std::vector<FieldMeta*> fms,
...
@@ -93,6 +93,8 @@ std::shared_ptr<ReturnMeta> getReturnMeta(std::vector<FieldMeta*> fms,
if
(
index
==-
1
)
assert
(
0
);
if
(
index
==-
1
)
assert
(
0
);
onion
o
=
tfds
[
i
].
getChoosenOnionO
()[
index
];
onion
o
=
tfds
[
i
].
getChoosenOnionO
()[
index
];
glog
<<
"choosenDecryptionOnion: "
<<
TypeText
<
onion
>::
toText
(
o
)
<<
"
\n
"
;
SECLEVEL
l
=
tfds
[
i
].
getOriginalFieldMeta
()
->
getOnionMeta
(
o
)
->
getSecLevel
();
SECLEVEL
l
=
tfds
[
i
].
getOriginalFieldMeta
()
->
getOnionMeta
(
o
)
->
getSecLevel
();
FieldMeta
*
k
=
tfds
[
i
].
getOriginalFieldMeta
();
FieldMeta
*
k
=
tfds
[
i
].
getOriginalFieldMeta
();
OLK
curOLK
(
o
,
l
,
k
);
OLK
curOLK
(
o
,
l
,
k
);
...
@@ -126,8 +128,10 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
...
@@ -126,8 +128,10 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
/*choosen onions should all be included in gfb. salt is also included
/*choosen onions should all be included in gfb. salt is also included
it's hard to decide whether a FieldMetaTrans has salt because the senmantic is different from that of FieldMeta.
it's hard to decide whether a FieldMetaTrans has salt because the senmantic is different from that of FieldMeta.
*/
*/
for
(
auto
&
item
:
res
){
for
(
auto
&
item
:
res
){
for
(
auto
i
:
item
.
getChoosenOnionName
()){
/* for(auto i:item.getChoosenOnionName()){
field_names.push_back(i);
field_names.push_back(i);
}
}
for(auto i:item.getChoosenFieldTypes()){
for(auto i:item.getChoosenFieldTypes()){
...
@@ -136,12 +140,31 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
...
@@ -136,12 +140,31 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
for(auto i:item.getChoosenFieldLengths()){
for(auto i:item.getChoosenFieldLengths()){
field_lengths.push_back(i);
field_lengths.push_back(i);
}
}
*/
//only choose onions that are used.
for
(
auto
i
=
0u
;
i
<
item
.
getChoosenOnionName
().
size
();
i
++
){
onion
o
=
item
.
getChoosenOnionO
()[
i
];
if
(
((
o
==
oDET
)
&&
(
constGlobalConstants
.
useDET
==
true
))
||
((
o
==
oOPE
)
&&
(
constGlobalConstants
.
useOPE
==
true
))
||
((
o
==
oASHE
)
&&
(
constGlobalConstants
.
useASHE
==
true
))
||
((
o
==
oAGG
)
&&
(
constGlobalConstants
.
useHOM
==
true
))
||
((
o
==
oSWP
)
&&
(
constGlobalConstants
.
useSWP
==
true
))
)
{
field_names
.
push_back
(
item
.
getChoosenOnionName
()[
i
]);
field_types
.
push_back
(
item
.
getChoosenFieldTypes
()[
i
]);
field_lengths
.
push_back
(
item
.
getChoosenFieldLengths
()[
i
]);
glog
<<
"usedField: "
<<
item
.
getChoosenOnionName
()[
i
]
<<
"
\n
"
;
}
}
if
(
item
.
getHasSalt
()){
if
(
item
.
getHasSalt
()){
field_names
.
push_back
(
item
.
getSaltName
());
field_names
.
push_back
(
item
.
getSaltName
());
field_types
.
push_back
(
item
.
getSaltType
());
field_types
.
push_back
(
item
.
getSaltType
());
field_lengths
.
push_back
(
item
.
getSaltLength
());
field_lengths
.
push_back
(
item
.
getSaltLength
());
glog
<<
"useSalt: "
<<
item
.
getSaltName
()
<<
"
\n
"
;
}
else
{
glog
<<
"do not use salt"
<<
"
\n
"
;
}
}
}
}
gfb
.
field_names
=
field_names
;
gfb
.
field_names
=
field_names
;
gfb
.
field_types
=
field_types
;
gfb
.
field_types
=
field_types
;
gfb
.
field_lengths
=
field_lengths
;
gfb
.
field_lengths
=
field_lengths
;
...
@@ -369,6 +392,7 @@ main(int argc, char* argv[]){
...
@@ -369,6 +392,7 @@ main(int argc, char* argv[]){
break
;
break
;
}
}
}
}
glog
<<
"reencryptionAndInsert: "
<<
glog
<<
"reencryptionAndInsert: "
<<
std
::
to_string
(
t_init
.
lap
()
/
1000000u
)
<<
std
::
to_string
(
t_init
.
lap
()
/
1000000u
)
<<
"##"
<<
std
::
to_string
(
time
(
NULL
))
<<
"
\n
"
;
"##"
<<
std
::
to_string
(
time
(
NULL
))
<<
"
\n
"
;
...
...
util/constants.cc
View file @
3e37e752
...
@@ -18,14 +18,44 @@ globalConstants initGlobalConstants(){
...
@@ -18,14 +18,44 @@ globalConstants initGlobalConstants(){
globalConstants
res
;
globalConstants
res
;
std
::
string
line
;
std
::
string
line
;
while
(
std
::
getline
(
infile
,
line
)){
while
(
std
::
getline
(
infile
,
line
))
{
int
index
=
line
.
find
(
":"
);
int
index
=
line
.
find
(
":"
);
std
::
string
head
=
line
.
substr
(
0
,
index
);
std
::
string
head
=
line
.
substr
(
0
,
index
);
if
(
head
==
"loadCount"
){
if
(
head
==
"loadCount"
)
{
res
.
loadCount
=
stoi
(
line
.
substr
(
index
+
1
));
res
.
loadCount
=
stoi
(
line
.
substr
(
index
+
1
));
}
else
if
(
head
==
"pipelineCount"
){
}
else
if
(
head
==
"pipelineCount"
)
{
res
.
pipelineCount
=
stoi
(
line
.
substr
(
index
+
1
));
res
.
pipelineCount
=
stoi
(
line
.
substr
(
index
+
1
));
}
else
if
(
head
==
"other"
){
}
else
if
(
head
==
"useASHE"
)
{
if
(
line
.
substr
(
index
+
1
)
==
"true"
){
res
.
useASHE
=
true
;
}
else
{
res
.
useASHE
=
false
;
}
}
else
if
(
head
==
"useHOM"
)
{
if
(
line
.
substr
(
index
+
1
)
==
"true"
){
res
.
useHOM
=
true
;
}
else
{
res
.
useHOM
=
false
;
}
}
else
if
(
head
==
"useOPE"
)
{
if
(
line
.
substr
(
index
+
1
)
==
"true"
){
res
.
useOPE
=
true
;
}
else
{
res
.
useOPE
=
false
;
}
}
else
if
(
head
==
"useSWP"
)
{
if
(
line
.
substr
(
index
+
1
)
==
"true"
){
res
.
useSWP
=
true
;
}
else
{
res
.
useSWP
=
false
;
}
}
else
if
(
head
==
"useDET"
)
{
if
(
line
.
substr
(
index
+
1
)
==
"true"
){
res
.
useDET
=
true
;
}
else
{
res
.
useDET
=
false
;
}
}
else
if
(
head
==
"other"
)
{
;
;
}
else
{
}
else
{
assert
(
0
);
assert
(
0
);
...
...
util/constants.hh
View file @
3e37e752
...
@@ -12,6 +12,11 @@ added by et. all et related things.
...
@@ -12,6 +12,11 @@ added by et. all et related things.
struct
globalConstants
{
struct
globalConstants
{
int
loadCount
;
/*used to limit the number of final_load*/
int
loadCount
;
/*used to limit the number of final_load*/
int
pipelineCount
;
int
pipelineCount
;
bool
useASHE
;
bool
useHOM
;
bool
useOPE
;
bool
useSWP
;
bool
useDET
;
std
::
string
logFile
;
/*file name for log*/
std
::
string
logFile
;
/*file name for log*/
};
};
...
...
wrapper/reuse.cc
View file @
3e37e752
#include "wrapper/reuse.hh"
#include "wrapper/reuse.hh"
#include "util/util.hh"
#include "util/util.hh"
#include "util/constants.hh"
#include <map>
#include <map>
using
std
::
cout
;
using
std
::
cout
;
using
std
::
cin
;
using
std
::
cin
;
...
@@ -606,10 +607,17 @@ int getDecryptionOnionIndex(FieldMetaTrans& fdtrans) {
...
@@ -606,10 +607,17 @@ int getDecryptionOnionIndex(FieldMetaTrans& fdtrans) {
}
}
for
(
auto
item
:
onion_order
){
for
(
auto
item
:
onion_order
){
if
(
onionIndexPair
.
find
(
item
)
!=
onionIndexPair
.
end
()){
if
(
onionIndexPair
.
find
(
item
)
!=
onionIndexPair
.
end
()){
res
=
onionIndexPair
[
item
];
if
(
((
item
==
oDET
)
&&
(
constGlobalConstants
.
useDET
==
true
))
||
break
;
((
item
==
oOPE
)
&&
(
constGlobalConstants
.
useOPE
==
true
))
||
((
item
==
oASHE
)
&&
(
constGlobalConstants
.
useASHE
==
true
))
||
((
item
==
oAGG
)
&&
(
constGlobalConstants
.
useHOM
==
true
))
){
res
=
onionIndexPair
[
item
];
break
;
}
}
}
}
}
assert
(
res
!=-
1
);
return
res
;
return
res
;
}
}
...
...
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