Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
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
董子豪
sgxwallet
Commits
d4d28bdf
Unverified
Commit
d4d28bdf
authored
Aug 27, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added gmp
parent
a3e35722
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
11 deletions
+31
-11
.gitignore
.gitignore
+4
-0
BLSUtils.cpp
secure_enclave/BLSUtils.cpp
+12
-6
BLSUtils.h
secure_enclave/BLSUtils.h
+1
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+4
-2
secure_enclave.edl
secure_enclave/secure_enclave.edl
+1
-1
sgxd.c
sgxd.c
+9
-1
No files found.
.gitignore
View file @
d4d28bdf
...
@@ -19,3 +19,7 @@ install-sh
...
@@ -19,3 +19,7 @@ install-sh
/.deps/
/.deps/
/CMakeCache.txt
/CMakeCache.txt
/cmake_install.cmake
/cmake_install.cmake
/sgxd.cbp
/sgx-gmp/
!/sgx-sdk-build/
/secure_enclave/Makefile
secure_enclave/BLSUtils.cpp
View file @
d4d28bdf
...
@@ -24,24 +24,30 @@ std::string* stringFromKey(libff::alt_bn128_Fr* _key) {
...
@@ -24,24 +24,30 @@ std::string* stringFromKey(libff::alt_bn128_Fr* _key) {
}
}
libff
::
alt_bn128_Fr
*
keyFromString
(
std
::
string
*
_keyString
)
{
libff
::
alt_bn128_Fr
*
keyFromString
(
std
::
string
&
_keyString
)
{
return
new
libff
::
alt_bn128_Fr
(
_keyString
->
c_str
());
return
new
libff
::
alt_bn128_Fr
(
_keyString
.
c_str
());
}
}
void
import_key
()
{
void
import_key
(
const
char
*
_keyString
)
{
std
::
string
keyString
=
"4160780231445160889237664391382223604184857153814275770598791864649971919844"
;
auto
key1
=
keyFromString
(
&
keyString
);
if
(
_keyString
==
nullptr
)
throw
std
::
exception
();
std
::
string
ks
(
_keyString
);
//std::string keyString = "4160780231445160889237664391382223604184857153814275770598791864649971919844";
auto
key1
=
keyFromString
(
ks
);
auto
s1
=
stringFromKey
(
key1
);
auto
s1
=
stringFromKey
(
key1
);
auto
key2
=
keyFromString
(
s1
);
auto
key2
=
keyFromString
(
*
s1
);
auto
s2
=
stringFromKey
(
key2
);
auto
s2
=
stringFromKey
(
key2
);
...
...
secure_enclave/BLSUtils.h
View file @
d4d28bdf
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#define EXTERNC
#define EXTERNC
#endif
#endif
EXTERNC
void
import_key
();
EXTERNC
void
import_key
(
const
char
*
_keyString
);
#endif //SGXD_BLSUTILS_H
#endif //SGXD_BLSUTILS_H
secure_enclave/secure_enclave.c
View file @
d4d28bdf
...
@@ -177,10 +177,12 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un)
...
@@ -177,10 +177,12 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un)
mpz_t
c3
,
c4
,
c5
;
mpz_t
c3
,
c4
,
c5
;
int
pi_init
=
0
;
int
pi_init
=
0
;
void
encrypt_key
(
mpf_t
*
pi_un
,
uint64_t
digits
)
void
encrypt_key
(
mpf_t
*
pi_un
,
uint64_t
digits
,
char
key
[
100
]
)
{
{
import_key
();
import_key
(
key
);
mpf_t
pi
;
mpf_t
pi
;
...
...
secure_enclave/secure_enclave.edl
View file @
d4d28bdf
...
@@ -21,7 +21,7 @@ enclave {
...
@@ -21,7 +21,7 @@ enclave {
[user_check] mpf_t *c, [user_check] mpf_t *a, [user_check] mpf_t *b
[user_check] mpf_t *c, [user_check] mpf_t *a, [user_check] mpf_t *b
);
);
public void encrypt_key ([user_check] mpf_t *pi, uint64_t digits);
public void encrypt_key ([user_check] mpf_t *pi, uint64_t digits
, [in] char key[100]
);
};
};
...
...
sgxd.c
View file @
d4d28bdf
...
@@ -112,7 +112,15 @@ int main (int argc, char *argv[])
...
@@ -112,7 +112,15 @@ int main (int argc, char *argv[])
mpf_init
(
pi
);
mpf_init
(
pi
);
status
=
encrypt_key
(
eid
,
&
pi
,
digits
);
const
char
*
key
=
"4160780231445160889237664391382223604184857153814275770598791864649971919844"
;
char
keyArray
[
100
];
strncpy
(
keyArray
,
key
,
100
);
status
=
encrypt_key
(
eid
,
&
pi
,
digits
,
keyArray
);
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
fprintf
(
stderr
,
"ECALL e_pi: 0x%04x
\n
"
,
status
);
fprintf
(
stderr
,
"ECALL e_pi: 0x%04x
\n
"
,
status
);
return
1
;
return
1
;
...
...
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